Skip to content
Snippets Groups Projects
Commit ef235552 authored by Avi Kivity's avatar Avi Kivity Committed by Pekka Enberg
Browse files

bsd: reconcile sys/param.h with system header


Include the system header and remove duplicate definitions.

Change some solaris imports to use _GNU_SOURCE to make rlim64_t defined
consistently.

Reviewed-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent a24adb4b
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ cflags-zfs-cmd-includes = $(cflags-libzfs-include)
$(zfs-cmd-objects): kernel-defines =
$(zfs-cmd-objects): CFLAGS += -D_GNU_SOURCE
$(zfs-cmd-objects): local-includes += $(cflags-zfs-cmd-includes)
$(zfs-cmd-objects): CFLAGS += -Wno-switch -D__va_list=__builtin_va_list '-DTEXT_DOMAIN=""' \
......
......@@ -7,6 +7,8 @@ cflags-zpool-cmd-includes = $(cflags-libzfs-include) -I$(src)/bsd/cddl/contrib/o
$(zpool-cmd-objects): kernel-defines =
$(zpool-cmd-objects): CFLAGS += -D_GNU_SOURCE
$(zpool-cmd-objects): local-includes += $(cflags-zpool-cmd-includes)
$(zpool-cmd-objects): CFLAGS += -Wno-switch -D__va_list=__builtin_va_list '-DTEXT_DOMAIN=""' \
......
......@@ -38,6 +38,8 @@ $(libzfs-objects): post-includes-bsd =
$(libzfs-objects): kernel-defines =
$(libzfs-objects): CFLAGS += -D_GNU_SOURCE
$(libzfs-objects): CFLAGS += -Wno-switch -D__va_list=__builtin_va_list '-DTEXT_DOMAIN=""' \
-Wno-maybe-uninitialized -Wno-unused-variable -Wno-unknown-pragmas -Wno-unused-function
......
......@@ -84,6 +84,7 @@ extern "C" {
#include <sys/sysevent/dev.h>
#include <machine/atomic.h>
#include <sys/debug.h>
#include <sys/resource.h>
#define ZFS_EXPORTS_PATH "/etc/zfs/exports"
......@@ -107,7 +108,6 @@ extern "C" {
#define ZFS_LOG(...) do { } while (0)
typedef u_longlong_t rlim64_t;
#define RLIM64_INFINITY ((rlim64_t)-3)
#ifdef ZFS_DEBUG
......
......@@ -74,7 +74,6 @@ typedef bool boolean_t;
typedef short index_t;
typedef off_t offset_t;
typedef long ptrdiff_t; /* pointer difference */
typedef int64_t rlim64_t;
typedef int major_t;
#else
......
......@@ -39,6 +39,7 @@
#define _SYS_PARAM_H_
#include <limits.h>
#include <api/sys/param.h>
#define BSD 199506 /* System version (year & month). */
#define BSD4_3 1
......@@ -100,12 +101,6 @@
#define MAXINTERP PATH_MAX /* max interpreter file name length */
#define MAXLOGNAME 17 /* max login name length (incl. NUL) */
#define MAXUPRC CHILD_MAX /* max simultaneous processes */
#define NCARGS ARG_MAX /* max bytes for an exec function */
#define NGROUPS (NGROUPS_MAX+1) /* max number groups */
#define NOFILE OPEN_MAX /* max open files per process */
#define NOGROUP 65535 /* marker for empty group set member */
#define MAXHOSTNAMELEN 256 /* max hostname size */
#define SPECNAMELEN 63 /* max length of devicename */
/* More types and definitions used throughout the kernel. */
#ifdef _KERNEL
......@@ -126,7 +121,6 @@
#ifndef DEV_BSHIFT
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#endif
#define DEV_BSIZE (1<<DEV_BSHIFT)
#ifndef BLKDEV_IOSIZE
#define BLKDEV_IOSIZE PAGE_SIZE /* default block device I/O size */
......@@ -237,35 +231,13 @@
#define BKVASIZE 16384 /* must be power of 2 */
#define BKVAMASK (BKVASIZE-1)
/*
* MAXPATHLEN defines the longest permissible path length after expanding
* symbolic links. It is used to allocate a temporary buffer from the buffer
* pool in which to do the name expansion, hence should be a power of two,
* and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the
* maximum number of symbolic links that may be expanded in a path name.
* It should be set high enough to allow all legitimate uses, but halt
* infinite loops reasonably quickly.
*/
#define MAXPATHLEN PATH_MAX
#define MAXSYMLINKS 32
/* Bit map related macros. */
#define setbit(a,i) (((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY))
#define clrbit(a,i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY)))
#define isset(a,i) \
(((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY)))
#define isclr(a,i) \
((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
/* Macros for counting and rounding. */
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
#define nitems(x) (sizeof((x)) / sizeof((x)[0]))
#define rounddown(x, y) (((x)/(y))*(y))
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */
#define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */
#define powerof2(x) ((((x)-1)&(x))==0)
/* Macros for min/max. */
#ifndef MIN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment