mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
cstyle: Resolve C style issues
The vast majority of these changes are in Linux specific code. They are the result of not having an automated style checker to validate the code when it was originally written. Others were caused when the common code was slightly adjusted for Linux. This patch contains no functional changes. It only refreshes the code to conform to style guide. Everyone submitting patches for inclusion upstream should now run 'make checkstyle' and resolve any warning prior to opening a pull request. The automated builders have been updated to fail a build if when 'make checkstyle' detects an issue. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #1821
This commit is contained in:
committed by
Brian Behlendorf
parent
8ffef572ed
commit
d1d7e2689d
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_BITMAP_H
|
||||
#define _LIBSPL_SYS_BITMAP_H
|
||||
#define _LIBSPL_SYS_BITMAP_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CALLB_H
|
||||
#define _SYS_CALLB_H
|
||||
#define _SYS_CALLB_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_CMN_ERR_H
|
||||
#define _LIBSPL_SYS_CMN_ERR_H
|
||||
#define _LIBSPL_SYS_CMN_ERR_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_COMPRESS_H
|
||||
#define _LIBSPL_SYS_COMPRESS_H
|
||||
#define _LIBSPL_SYS_COMPRESS_H
|
||||
|
||||
#endif /* _LIBSPL_SYS_COMPRESS_H */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_CRED_H
|
||||
#define _LIBSPL_SYS_CRED_H
|
||||
#define _LIBSPL_SYS_CRED_H
|
||||
|
||||
typedef struct cred cred_t;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_DEBUG_H
|
||||
#define _LIBSPL_SYS_DEBUG_H
|
||||
#define _LIBSPL_SYS_DEBUG_H
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FEATURE_TESTS_H
|
||||
#define _SYS_FEATURE_TESTS_H
|
||||
#define _SYS_FEATURE_TESTS_H
|
||||
|
||||
#define __NORETURN __attribute__((__noreturn__))
|
||||
#define __NORETURN __attribute__((__noreturn__))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,26 +25,26 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_FILE_H
|
||||
#define _LIBSPL_SYS_FILE_H
|
||||
#define _LIBSPL_SYS_FILE_H
|
||||
|
||||
#include_next <sys/file.h>
|
||||
|
||||
#include <sys/user.h>
|
||||
|
||||
#define FREAD 1
|
||||
#define FWRITE 2
|
||||
//#define FAPPEND 8
|
||||
#define FREAD 1
|
||||
#define FWRITE 2
|
||||
// #define FAPPEND 8
|
||||
|
||||
#define FCREAT O_CREAT
|
||||
#define FTRUNC O_TRUNC
|
||||
#define FOFFMAX O_LARGEFILE
|
||||
#define FSYNC O_SYNC
|
||||
#define FDSYNC O_DSYNC
|
||||
#define FRSYNC O_RSYNC
|
||||
#define FEXCL O_EXCL
|
||||
#define FCREAT O_CREAT
|
||||
#define FTRUNC O_TRUNC
|
||||
#define FOFFMAX O_LARGEFILE
|
||||
#define FSYNC O_SYNC
|
||||
#define FDSYNC O_DSYNC
|
||||
#define FRSYNC O_RSYNC
|
||||
#define FEXCL O_EXCL
|
||||
|
||||
#define FNODSYNC 0x10000 /* fsync pseudo flag */
|
||||
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
|
||||
#define FIGNORECASE 0x80000 /* request case-insensitive lookups */
|
||||
#define FNODSYNC 0x10000 /* fsync pseudo flag */
|
||||
#define FNOFOLLOW 0x20000 /* don't follow symlinks */
|
||||
#define FIGNORECASE 0x80000 /* request case-insensitive lookups */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _SYS_FRAME_H
|
||||
#define _SYS_FRAME_H
|
||||
#define _SYS_FRAME_H
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_INT_LIMITS_H
|
||||
#define _LIBSPL_SYS_INT_LIMITS_H
|
||||
#define _LIBSPL_SYS_INT_LIMITS_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_INT_TYPES_H
|
||||
#define _SOL_SYS_INT_TYPES_H
|
||||
#define _SOL_SYS_INT_TYPES_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
*/
|
||||
|
||||
#ifndef _SOL_SYS_INTTYPES_H
|
||||
#define _SOL_SYS_INTTYPES_H
|
||||
#define _SOL_SYS_INTTYPES_H
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#define _INT64_TYPE
|
||||
#define _INT64_TYPE
|
||||
|
||||
#endif
|
||||
|
||||
@@ -35,91 +35,91 @@ extern "C" {
|
||||
#if defined(__x86_64) || defined(__x86_64__)
|
||||
|
||||
#if !defined(__x86_64)
|
||||
#define __x86_64
|
||||
#define __x86_64
|
||||
#endif
|
||||
|
||||
#if !defined(__amd64)
|
||||
#define __amd64
|
||||
#define __amd64
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
#if !defined(_LP64)
|
||||
#define _LP64
|
||||
#define _LP64
|
||||
#endif
|
||||
|
||||
#if !defined(_LITTLE_ENDIAN)
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _SUNOS_VTOC_16
|
||||
|
||||
/* i386 arch specific defines */
|
||||
#elif defined(__i386) || defined(__i386__)
|
||||
|
||||
#if !defined(__i386)
|
||||
#define __i386
|
||||
#define __i386
|
||||
#endif
|
||||
|
||||
#if !defined(__x86)
|
||||
#define __x86
|
||||
#define __x86
|
||||
#endif
|
||||
|
||||
#if !defined(_ILP32)
|
||||
#define _ILP32
|
||||
#define _ILP32
|
||||
#endif
|
||||
|
||||
#if !defined(_LITTLE_ENDIAN)
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _SUNOS_VTOC_16
|
||||
|
||||
/* powerpc arch specific defines */
|
||||
#elif defined(__powerpc) || defined(__powerpc__)
|
||||
|
||||
#if !defined(__powerpc)
|
||||
#define __powerpc
|
||||
#define __powerpc
|
||||
#endif
|
||||
|
||||
#if !defined(__powerpc__)
|
||||
#define __powerpc__
|
||||
#define __powerpc__
|
||||
#endif
|
||||
|
||||
#if !defined(_LP64)
|
||||
#ifdef __powerpc64__
|
||||
#define _LP64
|
||||
#define _LP64
|
||||
#else
|
||||
#define _LP32
|
||||
#define _LP32
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(_BIG_ENDIAN)
|
||||
#define _BIG_ENDIAN
|
||||
#define _BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _SUNOS_VTOC_16
|
||||
|
||||
/* arm arch specific defines */
|
||||
#elif defined(__arm) || defined(__arm__)
|
||||
|
||||
#if !defined(__arm)
|
||||
#define __arm
|
||||
#define __arm
|
||||
#endif
|
||||
|
||||
#if !defined(__arm__)
|
||||
#define __arm__
|
||||
#define __arm__
|
||||
#endif
|
||||
|
||||
#if defined(__ARMEL__)
|
||||
#define _LITTLE_ENDIAN
|
||||
#define _LITTLE_ENDIAN
|
||||
#else
|
||||
#define _BIG_ENDIAN
|
||||
#define _BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#define _SUNOS_VTOC_16
|
||||
#define _SUNOS_VTOC_16
|
||||
|
||||
#else /* Currently only x86_64, i386, arm, and powerpc arches supported */
|
||||
#error "Unsupported ISA type"
|
||||
|
||||
@@ -35,8 +35,8 @@ extern "C" {
|
||||
#define KM_SLEEP 0x00000000 /* same as KM_SLEEP */
|
||||
#define KM_NOSLEEP 0x00000001 /* same as KM_NOSLEEP */
|
||||
|
||||
#define kmem_alloc(size, flags) malloc(size)
|
||||
#define kmem_free(ptr, size) free(ptr)
|
||||
#define kmem_alloc(size, flags) malloc(size)
|
||||
#define kmem_free(ptr, size) free(ptr)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_MKDEV_H
|
||||
#define _LIBSPL_SYS_MKDEV_H
|
||||
#define _LIBSPL_SYS_MKDEV_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T*/
|
||||
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
|
||||
/* All Rights Reserved */
|
||||
/*
|
||||
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
|
||||
@@ -28,7 +28,7 @@
|
||||
/* Copyright 2006 Ricardo Correia */
|
||||
|
||||
#ifndef _SYS_MNTTAB_H
|
||||
#define _SYS_MNTTAB_H
|
||||
#define _SYS_MNTTAB_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <mntent.h>
|
||||
@@ -77,10 +77,10 @@ static inline char *_sol_hasmntopt(struct mnttab *mnt, char *opt)
|
||||
|
||||
mnt_new.mnt_opts = mnt->mnt_mntopts;
|
||||
|
||||
return hasmntopt(&mnt_new, opt);
|
||||
return (hasmntopt(&mnt_new, opt));
|
||||
}
|
||||
|
||||
#define hasmntopt _sol_hasmntopt
|
||||
#define getmntent _sol_getmntent
|
||||
#define hasmntopt _sol_hasmntopt
|
||||
#define getmntent _sol_getmntent
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include_next <sys/mount.h>
|
||||
|
||||
#ifndef _LIBSPL_SYS_MOUNT_H
|
||||
#define _LIBSPL_SYS_MOUNT_H
|
||||
#define _LIBSPL_SYS_MOUNT_H
|
||||
|
||||
#include <sys/mntent.h>
|
||||
#include <assert.h>
|
||||
@@ -39,7 +39,7 @@
|
||||
* and we don't want to require the kernel headers
|
||||
*/
|
||||
#if !defined(BLKGETSIZE64)
|
||||
#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
|
||||
#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -48,7 +48,7 @@
|
||||
* headers define MS_DIRSYNC to be S_WRITE.
|
||||
*/
|
||||
#if !defined(MS_DIRSYNC)
|
||||
#define MS_DIRSYNC S_WRITE
|
||||
#define MS_DIRSYNC S_WRITE
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -71,15 +71,15 @@
|
||||
* kernel back to 2.4.11 so we define them correctly if they are missing.
|
||||
*/
|
||||
#ifdef MNT_FORCE
|
||||
# define MS_FORCE MNT_FORCE
|
||||
#define MS_FORCE MNT_FORCE
|
||||
#else
|
||||
# define MS_FORCE 0x00000001
|
||||
#define MS_FORCE 0x00000001
|
||||
#endif /* MNT_FORCE */
|
||||
|
||||
#ifdef MNT_DETACH
|
||||
# define MS_DETACH MNT_DETACH
|
||||
#define MS_DETACH MNT_DETACH
|
||||
#else
|
||||
# define MS_DETACH 0x00000002
|
||||
#define MS_DETACH 0x00000002
|
||||
#endif /* MNT_DETACH */
|
||||
|
||||
/*
|
||||
@@ -87,6 +87,6 @@
|
||||
* compatibility, MS_OVERLAY is defined to explicitly have the user
|
||||
* provide a flag (-O) to mount over a non empty directory.
|
||||
*/
|
||||
#define MS_OVERLAY 0x00000004
|
||||
#define MS_OVERLAY 0x00000004
|
||||
|
||||
#endif /* _LIBSPL_SYS_MOUNT_H */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_PARAM_H
|
||||
#define _LIBSPL_SYS_PARAM_H
|
||||
#define _LIBSPL_SYS_PARAM_H
|
||||
|
||||
#include_next <sys/param.h>
|
||||
#include <unistd.h>
|
||||
@@ -43,20 +43,20 @@
|
||||
* Note that the blocked devices are assumed to have DEV_BSIZE
|
||||
* "sectors" and that fragments must be some multiple of this size.
|
||||
*/
|
||||
#define MAXBSIZE 8192
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
#define MAXBSIZE 8192
|
||||
#define DEV_BSIZE 512
|
||||
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
|
||||
|
||||
#define MAXNAMELEN 256
|
||||
#define MAXOFFSET_T LLONG_MAX
|
||||
#define MAXNAMELEN 256
|
||||
#define MAXOFFSET_T LLONG_MAX
|
||||
|
||||
#define UID_NOBODY 60001 /* user ID no body */
|
||||
#define GID_NOBODY UID_NOBODY
|
||||
#define UID_NOACCESS 60002 /* user ID no access */
|
||||
#define UID_NOBODY 60001 /* user ID no body */
|
||||
#define GID_NOBODY UID_NOBODY
|
||||
#define UID_NOACCESS 60002 /* user ID no access */
|
||||
|
||||
#define MAXUID UINT32_MAX /* max user id */
|
||||
#define MAXPROJID MAXUID /* max project id */
|
||||
#define MAXUID UINT32_MAX /* max user id */
|
||||
#define MAXPROJID MAXUID /* max project id */
|
||||
|
||||
#define PAGESIZE (sysconf(_SC_PAGESIZE))
|
||||
#define PAGESIZE (sysconf(_SC_PAGESIZE))
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_PRIV_H
|
||||
#define _LIBSPL_SYS_PRIV_H
|
||||
#define _LIBSPL_SYS_PRIV_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_PROCESSOR_H
|
||||
#define _LIBSPL_SYS_PROCESSOR_H
|
||||
#define _LIBSPL_SYS_PROCESSOR_H
|
||||
|
||||
#define getcpuid() (-1)
|
||||
#define getcpuid() (-1)
|
||||
|
||||
typedef int processorid_t;
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_SDT_H
|
||||
#define _LIBSPL_SYS_SDT_H
|
||||
#define _LIBSPL_SYS_SDT_H
|
||||
|
||||
#define DTRACE_PROBE(a) ((void) 0)
|
||||
#define DTRACE_PROBE1(a,b,c) ((void) 0)
|
||||
#define DTRACE_PROBE2(a,b,c,d,e) ((void) 0)
|
||||
#define DTRACE_PROBE3(a,b,c,d,e,f,g) ((void) 0)
|
||||
#define DTRACE_PROBE4(a,b,c,d,e,f,g,h,i) ((void) 0)
|
||||
#define DTRACE_PROBE(a) ((void) 0)
|
||||
#define DTRACE_PROBE1(a, b, c) ((void) 0)
|
||||
#define DTRACE_PROBE2(a, b, c, d, e) ((void) 0)
|
||||
#define DTRACE_PROBE3(a, b, c, d, e, f, g) ((void) 0)
|
||||
#define DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) ((void) 0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
* Portions Copyright 2008 Sun Microsystems, Inc. All Rights reserved.
|
||||
*/
|
||||
#ifndef _SYS_STACK_H
|
||||
#define _SYS_STACK_H
|
||||
#define _SYS_STACK_H
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define STACK_BIAS 0
|
||||
#define STACK_BIAS 0
|
||||
|
||||
#ifdef __USE_GNU
|
||||
|
||||
@@ -39,7 +39,7 @@ stack_getbounds(stack_t *sp)
|
||||
|
||||
rc = pthread_getattr_np(pthread_self(), &attr);
|
||||
if (rc)
|
||||
return rc;
|
||||
return (rc);
|
||||
|
||||
rc = pthread_attr_getstack(&attr, &sp->ss_sp, &sp->ss_size);
|
||||
if (rc == 0)
|
||||
@@ -47,7 +47,7 @@ stack_getbounds(stack_t *sp)
|
||||
|
||||
pthread_attr_destroy(&attr);
|
||||
|
||||
return rc;
|
||||
return (rc);
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -57,15 +57,17 @@ thr_stksegment(stack_t *sp)
|
||||
|
||||
rc = stack_getbounds(sp);
|
||||
if (rc)
|
||||
return rc;
|
||||
return (rc);
|
||||
|
||||
/* thr_stksegment() is expected to set sp.ss_sp to the high stack
|
||||
* address, but the stack_getbounds() interface is expected to
|
||||
* set sp.ss_sp to the low address. Adjust accordingly. */
|
||||
/*
|
||||
* thr_stksegment() is expected to set sp.ss_sp to the high stack
|
||||
* address, but the stack_getbounds() interface is expected to
|
||||
* set sp.ss_sp to the low address. Adjust accordingly.
|
||||
*/
|
||||
sp->ss_sp = (void *)(((uintptr_t)sp->ss_sp) + sp->ss_size);
|
||||
sp->ss_flags = 0;
|
||||
|
||||
return rc;
|
||||
return (rc);
|
||||
}
|
||||
|
||||
#endif /* __USE_GNU */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_STAT_H
|
||||
#define _LIBSPL_SYS_STAT_H
|
||||
#define _LIBSPL_SYS_STAT_H
|
||||
|
||||
#include_next <sys/stat.h>
|
||||
|
||||
@@ -37,14 +37,14 @@ static inline int
|
||||
fstat64_blk(int fd, struct stat64 *st)
|
||||
{
|
||||
if (fstat64(fd, st) == -1)
|
||||
return -1;
|
||||
return (-1);
|
||||
|
||||
/* In Linux we need to use an ioctl to get the size of a block device */
|
||||
if (S_ISBLK(st->st_mode)) {
|
||||
if (ioctl(fd, BLKGETSIZE64, &st->st_size) != 0)
|
||||
return -1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
#endif /* _LIBSPL_SYS_STAT_H */
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_STROPTS_H
|
||||
#define _LIBSPL_SYS_STROPTS_H
|
||||
#define _LIBSPL_SYS_STROPTS_H
|
||||
|
||||
#endif /* _LIBSPL_SYS_STROPTS_H */
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_SYSEVENT_H
|
||||
#define _LIBSPL_SYS_SYSEVENT_H
|
||||
#define _LIBSPL_SYS_SYSEVENT_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,41 +25,41 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_SYSMACROS_H
|
||||
#define _LIBSPL_SYS_SYSMACROS_H
|
||||
#define _LIBSPL_SYS_SYSMACROS_H
|
||||
|
||||
#include_next <sys/sysmacros.h>
|
||||
|
||||
/* common macros */
|
||||
#ifndef MIN
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
#endif
|
||||
#ifndef MAX
|
||||
#define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
#define MAX(a, b) ((a) < (b) ? (b) : (a))
|
||||
#endif
|
||||
#ifndef ABS
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
#endif
|
||||
|
||||
#define makedevice(maj,min) makedev(maj,min)
|
||||
#define _sysconf(a) sysconf(a)
|
||||
#define __NORETURN __attribute__ ((noreturn))
|
||||
#define makedevice(maj, min) makedev(maj, min)
|
||||
#define _sysconf(a) sysconf(a)
|
||||
#define __NORETURN __attribute__((noreturn))
|
||||
|
||||
/*
|
||||
* Compatibility macros/typedefs needed for Solaris -> Linux port
|
||||
*/
|
||||
#define P2ALIGN(x, align) ((x) & -(align))
|
||||
#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
|
||||
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
#define P2ALIGN(x, align) ((x) & -(align))
|
||||
#define P2CROSS(x, y, align) (((x) ^ (y)) > (align) - 1)
|
||||
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
(-(-(type)(x) & -(type)(align)))
|
||||
#define P2BOUNDARY(off, len, align) \
|
||||
#define P2BOUNDARY(off, len, align) \
|
||||
(((off) ^ ((off) + (len) - 1)) > (align) - 1)
|
||||
#define P2PHASE(x, align) ((x) & ((align) - 1))
|
||||
#define P2NPHASE(x, align) (-(x) & ((align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
#define P2PHASE(x, align) ((x) & ((align) - 1))
|
||||
#define P2NPHASE(x, align) (-(x) & ((align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
(-(type)(x) & ((type)(align) - 1))
|
||||
#define ISP2(x) (((x) & ((x) - 1)) == 0)
|
||||
#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
|
||||
#define ISP2(x) (((x) & ((x) - 1)) == 0)
|
||||
#define IS_P2ALIGNED(v, a) ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
|
||||
|
||||
/*
|
||||
* Typed version of the P2* macros. These macros should be used to ensure
|
||||
@@ -72,22 +72,22 @@
|
||||
* or
|
||||
* P2ROUNDUP_TYPED(x, PAGESIZE, uint64_t)
|
||||
*/
|
||||
#define P2ALIGN_TYPED(x, align, type) \
|
||||
((type)(x) & -(type)(align))
|
||||
#define P2PHASE_TYPED(x, align, type) \
|
||||
((type)(x) & ((type)(align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
(-(type)(x) & ((type)(align) - 1))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
(-(-(type)(x) & -(type)(align)))
|
||||
#define P2END_TYPED(x, align, type) \
|
||||
(-(~(type)(x) & -(type)(align)))
|
||||
#define P2PHASEUP_TYPED(x, align, phase, type) \
|
||||
((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
|
||||
#define P2CROSS_TYPED(x, y, align, type) \
|
||||
(((type)(x) ^ (type)(y)) > (type)(align) - 1)
|
||||
#define P2SAMEHIGHBIT_TYPED(x, y, type) \
|
||||
(((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
|
||||
#define P2ALIGN_TYPED(x, align, type) \
|
||||
((type)(x) & -(type)(align))
|
||||
#define P2PHASE_TYPED(x, align, type) \
|
||||
((type)(x) & ((type)(align) - 1))
|
||||
#define P2NPHASE_TYPED(x, align, type) \
|
||||
(-(type)(x) & ((type)(align) - 1))
|
||||
#define P2ROUNDUP_TYPED(x, align, type) \
|
||||
(-(-(type)(x) & -(type)(align)))
|
||||
#define P2END_TYPED(x, align, type) \
|
||||
(-(~(type)(x) & -(type)(align)))
|
||||
#define P2PHASEUP_TYPED(x, align, phase, type) \
|
||||
((type)(phase) - (((type)(phase) - (type)(x)) & -(type)(align)))
|
||||
#define P2CROSS_TYPED(x, y, align, type) \
|
||||
(((type)(x) ^ (type)(y)) > (type)(align) - 1)
|
||||
#define P2SAMEHIGHBIT_TYPED(x, y, type) \
|
||||
(((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))
|
||||
|
||||
|
||||
/* avoid any possibility of clashing with <stddef.h> version */
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_SYSTEMINFO_H
|
||||
#define _LIBSPL_SYS_SYSTEMINFO_H
|
||||
#define _LIBSPL_SYS_SYSTEMINFO_H
|
||||
|
||||
#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */
|
||||
#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
|
||||
#define HW_INVALID_HOSTID 0xFFFFFFFF /* an invalid hostid */
|
||||
#define HW_HOSTID_LEN 11 /* minimum buffer size needed */
|
||||
/* to hold a decimal or hex */
|
||||
/* hostid string */
|
||||
|
||||
#define sysinfo(cmd,buf,cnt) (-1)
|
||||
#define sysinfo(cmd, buf, cnt) (-1)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_SYSTM_H
|
||||
#define _LIBSPL_SYS_SYSTM_H
|
||||
#define _LIBSPL_SYS_SYSTM_H
|
||||
|
||||
#endif /* _LIBSPL_SYS_SYSTM_H */
|
||||
|
||||
@@ -25,37 +25,37 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_TIME_H
|
||||
#define _LIBSPL_SYS_TIME_H
|
||||
#define _LIBSPL_SYS_TIME_H
|
||||
|
||||
#include_next <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef SEC
|
||||
#define SEC 1
|
||||
#define SEC 1
|
||||
#endif
|
||||
|
||||
#ifndef MILLISEC
|
||||
#define MILLISEC 1000
|
||||
#define MILLISEC 1000
|
||||
#endif
|
||||
|
||||
#ifndef MICROSEC
|
||||
#define MICROSEC 1000000
|
||||
#define MICROSEC 1000000
|
||||
#endif
|
||||
|
||||
#ifndef NANOSEC
|
||||
#define NANOSEC 1000000000
|
||||
#define NANOSEC 1000000000
|
||||
#endif
|
||||
|
||||
#ifndef NSEC_PER_USEC
|
||||
#define NSEC_PER_USEC 1000L
|
||||
#define NSEC_PER_USEC 1000L
|
||||
#endif
|
||||
|
||||
#ifndef MSEC2NSEC
|
||||
#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
|
||||
#define MSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / MILLISEC))
|
||||
#endif
|
||||
|
||||
#ifndef NSEC2MSEC
|
||||
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
|
||||
#define NSEC2MSEC(n) ((n) / (NANOSEC / MILLISEC))
|
||||
#endif
|
||||
|
||||
extern hrtime_t gethrtime(void);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_TYPES_H
|
||||
#define _LIBSPL_SYS_TYPES_H
|
||||
#define _LIBSPL_SYS_TYPES_H
|
||||
|
||||
#include <sys/isa_defs.h>
|
||||
#include <sys/feature_tests.h>
|
||||
@@ -53,9 +53,9 @@ typedef u_longlong_t u_offset_t;
|
||||
typedef u_longlong_t len_t;
|
||||
typedef longlong_t diskaddr_t;
|
||||
|
||||
typedef ulong_t pfn_t; /* page frame number */
|
||||
typedef ulong_t pgcnt_t; /* number of pages */
|
||||
typedef long spgcnt_t; /* signed number of pages */
|
||||
typedef ulong_t pfn_t; /* page frame number */
|
||||
typedef ulong_t pgcnt_t; /* number of pages */
|
||||
typedef long spgcnt_t; /* signed number of pages */
|
||||
|
||||
typedef longlong_t hrtime_t;
|
||||
typedef struct timespec timestruc_t;
|
||||
|
||||
@@ -45,14 +45,14 @@
|
||||
typedef struct iovec iovec_t;
|
||||
|
||||
typedef enum uio_rw {
|
||||
UIO_READ = 0,
|
||||
UIO_WRITE = 1,
|
||||
UIO_READ = 0,
|
||||
UIO_WRITE = 1,
|
||||
} uio_rw_t;
|
||||
|
||||
typedef enum uio_seg {
|
||||
UIO_USERSPACE = 0,
|
||||
UIO_SYSSPACE = 1,
|
||||
UIO_USERISPACE= 2,
|
||||
UIO_USERSPACE = 0,
|
||||
UIO_SYSSPACE = 1,
|
||||
UIO_USERISPACE = 2,
|
||||
} uio_seg_t;
|
||||
|
||||
typedef struct uio {
|
||||
@@ -102,7 +102,7 @@ typedef struct xuio {
|
||||
} xu_ext;
|
||||
} xuio_t;
|
||||
|
||||
#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
|
||||
#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
|
||||
#define XUIO_XUZC_PRIV(xuio) xuio->xu_ext.xu_zc.xu_zc_priv
|
||||
#define XUIO_XUZC_RW(xuio) xuio->xu_ext.xu_zc.xu_zc_rw
|
||||
|
||||
#endif /* _SYS_UIO_H */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_UTSNAME_H
|
||||
#define _LIBSPL_UTSNAME_H
|
||||
#define _LIBSPL_UTSNAME_H
|
||||
|
||||
#include_next <sys/utsname.h>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
*/
|
||||
|
||||
#ifndef _SYS_VA_LIST_H
|
||||
#define _SYS_VA_LIST_H
|
||||
#define _SYS_VA_LIST_H
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_VARARGS_H
|
||||
#define _LIBSPL_SYS_VARARGS_H
|
||||
#define _LIBSPL_SYS_VARARGS_H
|
||||
|
||||
#endif
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_VNODE_H
|
||||
#define _LIBSPL_SYS_VNODE_H
|
||||
#define _LIBSPL_SYS_VNODE_H
|
||||
|
||||
#endif /* _LIBSPL_SYS_VNODE_H */
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
*/
|
||||
|
||||
#ifndef _LIBSPL_SYS_ZONE_H
|
||||
#define _LIBSPL_SYS_ZONE_H
|
||||
#define _LIBSPL_SYS_ZONE_H
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user