Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/ipf/netinet unifdef



details:   https://anonhg.NetBSD.org/src/rev/42057eb40b8f
branches:  trunk
changeset: 346855:42057eb40b8f
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Aug 05 09:05:02 2016 +0000

description:
unifdef

diffstat:

 sys/external/bsd/ipf/netinet/ip_compat.h |  1326 +-----------------------------
 1 files changed, 1 insertions(+), 1325 deletions(-)

diffs (truncated from 1384 to 300 lines):

diff -r 38a71c3a3c9c -r 42057eb40b8f sys/external/bsd/ipf/netinet/ip_compat.h
--- a/sys/external/bsd/ipf/netinet/ip_compat.h  Fri Aug 05 08:56:36 2016 +0000
+++ b/sys/external/bsd/ipf/netinet/ip_compat.h  Fri Aug 05 09:05:02 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_compat.h,v 1.10 2016/06/10 13:31:44 ozaki-r Exp $   */
+/*     $NetBSD: ip_compat.h,v 1.11 2016/08/05 09:05:02 christos Exp $  */
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -26,13 +26,11 @@
 # define       __KERNEL__
 #endif
 
-#ifndef        SOLARIS
 # if (defined(sun) && (defined(__svr4__) || defined(__SVR4)))
 #  define SOLARIS      1
 # else
 #  define SOLARIS      0
 # endif
-#endif
 #if (defined(SOLARIS2) && (SOLARIS2 >= 8))
 # ifndef       USE_INET6
 #  define      USE_INET6
@@ -132,703 +130,28 @@
 # endif
 #endif
 
-#if defined(__NetBSD_Version__)
 # define NETBSD_GE_REV(x)      (__NetBSD_Version__ >= (x))
 # define NETBSD_GT_REV(x)      (__NetBSD_Version__ > (x))
 # define NETBSD_LT_REV(x)      (__NetBSD_Version__ < (x))
-#else
-# define NETBSD_GE_REV(x)      0
-# define NETBSD_GT_REV(x)      0
-# define NETBSD_LT_REV(x)      0
-#endif
 
-#if defined(__FreeBSD_version)
-# define FREEBSD_GE_REV(x)     (__FreeBSD_version >= (x))
-# define FREEBSD_GT_REV(x)     (__FreeBSD_version > (x))
-# define FREEBSD_LT_REV(x)     (__FreeBSD_version < (x))
-#else
 # define FREEBSD_GE_REV(x)     0
 # define FREEBSD_GT_REV(x)     0
 # define FREEBSD_LT_REV(x)     0
-#endif
 
-#if defined(_BSDI_VERSION)
-# define BSDOS_GE_REV(x)       (_BSDI_VERSION >= (x))
-# define BSDOS_GT_REV(x)       (_BSDI_VERSION > (x))
-# define BSDOS_LT_REV(x)       (_BSDI_VERSION < (x))
-#else
 # define BSDOS_GE_REV(x)       0
 # define BSDOS_GT_REV(x)       0
 # define BSDOS_LT_REV(x)       0
-#endif
 
-#if defined(OpenBSD)
-# define OPENBSD_GE_REV(x)     (OpenBSD >= (x))
-# define OPENBSD_GT_REV(x)     (OpenBSD > (x))
-# define OPENBSD_LT_REV(x)     (OpenBSD < (x))
-#else
 # define OPENBSD_GE_REV(x)     0
 # define OPENBSD_GT_REV(x)     0
 # define OPENBSD_LT_REV(x)     0
-#endif
 
-#if defined(BSD)
 # define BSD_GE_YEAR(x)                (BSD >= (x))
 # define BSD_GT_YEAR(x)                (BSD > (x))
 # define BSD_LT_YEAR(x)                (BSD < (x))
-#else
-# define BSD_GE_YEAR(x)                0
-# define BSD_GT_YEAR(x)                0
-# define BSD_LT_YEAR(x)                0
-#endif
 
 
 /* ----------------------------------------------------------------------- */
-/*                                  S O L A R I S                          */
-/* ----------------------------------------------------------------------- */
-#if SOLARIS
-# define       MENTAT  1
-# include      <sys/cmn_err.h>
-# include      <sys/isa_defs.h>
-# include      <sys/stream.h>
-# include      <sys/ioccom.h>
-# include      <sys/sysmacros.h>
-# include      <sys/kmem.h>
-# if SOLARIS2 >= 10
-#  include     <sys/procset.h>
-#  include     <sys/proc.h>
-#  include     <sys/devops.h>
-#  include     <sys/ddi_impldefs.h>
-#  include     <sys/sdt.h>
-# endif
-/*
- * because Solaris 2 defines these in two places :-/
- */
-# ifndef       _KERNEL
-#  define      ADD_KERNEL
-#  define      _KERNEL
-#  undef       RES_INIT
-# endif /* _KERNEL */
-
-# if SOLARIS2 >= 8
-#  include <netinet/ip6.h>
-#  include <netinet/icmp6.h>
-# endif
-
-# include <inet/common.h>
-/* These 5 are defined in <inet/ip.h> and <netinet/ip.h> */
-# undef        IPOPT_EOL
-# undef        IPOPT_NOP
-# undef        IPOPT_LSRR
-# undef        IPOPT_RR
-# undef        IPOPT_SSRR
-# ifdef i386
-#  define _SYS_PROMIF_H
-# endif
-# ifdef        ADD_KERNEL
-#  undef       _KERNEL
-# endif
-# include <inet/mib2.h>
-# include <inet/ip.h>
-# undef COPYOUT
-# if !defined(_SYS_NETI_H)
-#  include <inet/ip_ire.h>
-# endif
-# if SOLARIS2 >= 8
-
-#  include <inet/ip_if.h>
-#  define      ipif_local_addr ipif_lcl_addr
-/* Only defined in private include file */
-#  ifndef      V4_PART_OF_V6
-#   define     V4_PART_OF_V6(v6)       v6.s6_addr32[3]
-#  endif
-struct ip6_ext {
-       u_char  ip6e_nxt;
-       u_char  ip6e_len;
-};
-# endif /* SOLARIS2 >= 8 */
-
-# if SOLARIS2 >= 6
-#  include <sys/atomic.h>
-typedef        uint8_t         u_int8_t;
-typedef        uint32_t        u_32_t;
-# else
-typedef        unsigned char   u_int8_t;
-typedef unsigned int   u_32_t;
-# endif
-# define       U_32_T  1
-# if SOLARIS2 >= 7
-#  define      USE_QUAD_T      1
-#  define      U_QUAD_T        uint64_t
-#  define      QUAD_T          int64_t
-# endif
-
-# ifdef _KERNEL
-#  define      NEED_LOCAL_RAND         1
-#  define      KRWLOCK_T               krwlock_t
-#  define      KMUTEX_T                kmutex_t
-#  if !defined(FW_HOOKS)
-#   include "qif.h"
-#   include "pfil.h"
-#  endif
-#  if SOLARIS2 >= 6
-#   if SOLARIS2 == 6
-#    define    ATOMIC_INCL(x)          atomic_add_long((uint32_t*)&(x), 1)
-#    define    ATOMIC_DECL(x)          atomic_add_long((uint32_t*)&(x), -1)
-#   else
-#    define    ATOMIC_INCL(x)          atomic_add_long(&(x), 1)
-#    define    ATOMIC_DECL(x)          atomic_add_long(&(x), -1)
-#   endif /* SOLARIS2 == 6 */
-#   define     ATOMIC_INC64(x)         atomic_add_64((uint64_t*)&(x), 1)
-#   define     ATOMIC_INC32(x)         atomic_add_32((uint32_t*)&(x), 1)
-#   define     ATOMIC_DEC64(x)         atomic_add_64((uint64_t*)&(x), -1)
-#   define     ATOMIC_DEC32(x)         atomic_add_32((uint32_t*)&(x), -1)
-#  else
-#   define     ATOMIC_INC(x)           { mutex_enter(&softc->ipf_rw); (x)++; \
-                                         mutex_exit(&softc->ipf_rw); }
-#   define     ATOMIC_DEC(x)           { mutex_enter(&softc->ipf_rw); (x)--; \
-                                         mutex_exit(&softc->ipf_rw); }
-#  endif /* SOLARIS2 >= 6 */
-#  define      USE_MUTEXES
-#  define      MUTEX_ENTER(x)          mutex_enter(&(x)->ipf_lk)
-#  define      READ_ENTER(x)           rw_enter(&(x)->ipf_lk, RW_READER)
-#  define      WRITE_ENTER(x)          rw_enter(&(x)->ipf_lk, RW_WRITER)
-#  define      MUTEX_DOWNGRADE(x)      rw_downgrade(&(x)->ipf_lk)
-#  define      RWLOCK_INIT(x, y)       rw_init(&(x)->ipf_lk, (y),  \
-                                               RW_DRIVER, NULL)
-#  define      RWLOCK_EXIT(x)          rw_exit(&(x)->ipf_lk)
-#  define      RW_DESTROY(x)           rw_destroy(&(x)->ipf_lk)
-#  define      MUTEX_INIT(x, y)        mutex_init(&(x)->ipf_lk, (y), \
-                                                  MUTEX_DRIVER, NULL)
-#  define      MUTEX_DESTROY(x)        mutex_destroy(&(x)->ipf_lk)
-#  define      MUTEX_NUKE(x)           bzero((x), sizeof(*(x)))
-#  define      MUTEX_EXIT(x)           mutex_exit(&(x)->ipf_lk)
-#  define      COPYIN(a,b,c)   copyin((caddr_t)(a), (caddr_t)(b), (c))
-#  define      COPYOUT(a,b,c)  copyout((caddr_t)(a), (caddr_t)(b), (c))
-#  define      BCOPYIN(a,b,c)  copyin((caddr_t)(a), (caddr_t)(b), (c))
-#  define      BCOPYOUT(a,b,c) copyout((caddr_t)(a), (caddr_t)(b), (c))
-#  define      UIOMOVE(a,b,c,d)        uiomove((caddr_t)a,b,c,d)
-#  define      KFREE(x)        kmem_free((char *)(x), sizeof(*(x)))
-#  define      KFREES(x,s)     kmem_free((char *)(x), (s))
-#  define      SPL_SCHED(x)    ;
-#  define      SPL_NET(x)      ;
-#  define      SPL_IMP(x)      ;
-#  undef       SPL_X
-#  define      SPL_X(x)        ;
-#  ifdef sparc
-#   define     ntohs(x)        (x)
-#   define     ntohl(x)        (x)
-#   define     htons(x)        (x)
-#   define     htonl(x)        (x)
-#  endif /* sparc */
-#  define      KMALLOC(a,b)    (a) = (b)kmem_alloc(sizeof(*(a)), KM_NOSLEEP)
-#  define      KMALLOCS(a,b,c) (a) = (b)kmem_alloc((c), KM_NOSLEEP)
-#  define      GET_MINOR(x)    getminor(x)
-extern void    *get_unit(void *, char *, int);
-#  define      GETIFP(n, v)    get_unit(softc, n, v)
-#  if defined(INSTANCES)
-#   include    <sys/hook.h>
-#   include    <sys/neti.h>
-typedef struct qpktinfo        {
-       void            *qpi_real;      /* the real one on the STREAM */
-       void            *qpi_ill;       /* COPIED */
-       mblk_t          *qpi_m;
-       queue_t         *qpi_q;
-       void            *qpi_data;      /* where layer 3 header starts */
-       size_t          qpi_off;
-       int             qpi_flags;      /* COPIED */
-} qpktinfo_t;
-
-#define        QF_MULTICAST    0x0001
-#define        QF_BROADCAST    0x0002
-
-typedef struct qifpkt {
-       struct qifpkt   *qp_next;
-       char            qp_ifname[LIFNAMSIZ];
-       int             qp_sap;
-       mblk_t          *qp_mb;
-       int             qp_inout;
-} qifpkt_t;
-
-#   define     COPYIFNAME(v, x,b)                                      \
-                       do {                                            \
-                               if ((v) == 4) {                         \
-                                       net_getifname(softc->ipf_nd_v4, \
-                                                     (phy_if_t)x, b,   \
-                                                     sizeof(b));       \
-                               } else {                                \
-                                       net_getifname(softc->ipf_nd_v6, \
-                                                     (phy_if_t)x, b,   \
-                                                     sizeof(b));       \
-                               }                                       \
-                       } while (0)
-#   define     GETIFMTU_4(x)   net_getmtu(softc->ipf_nd_v4, (phy_if_t)x, 0)
-#   define     GETIFMTU_6(x)   net_getmtu(softc->ipf_nd_v6, (phy_if_t)x, 0)
-#   define     GET_SOFTC(x)    ipf_find_softc(x)
-#  else
-#   define     FASTROUTE_RECURSION     1
-#   define     GET_SOFTC(x)    &ipfmain
-#   define     GETIFMTU_4(x)   ((qif_t *)x)->qf_max_frag
-#   define     GETIFMTU_6(x)   ((qif_t *)x)->qf_max_frag
-#   define     IFNAME(x)       ((qif_t *)x)->qf_name
-#   define     COPYIFNAME(v, x, b) \
-                               (void) strncpy(b, ((qif_t *)x)->qf_name, \
-                                              LIFNAMSIZ)
-#  endif
-#  define      GETKTIME(x)     uniqtime((struct timeval *)x)
-#  define      MSGDSIZE(m)     msgdsize(m)
-#  define      M_LEN(m)        ((m)->b_wptr - (m)->b_rptr)
-#  define      M_ADJ(m,x)      adjmsg(m, x)
-#  define      M_COPY(x)       dupmsg((x))
-#  define      MTOD(m,t)       ((t)((m)->b_rptr))
-#  define      MTYPE(m)        ((m)->b_datap->db_type)
-#  define      FREE_MB_T(m)    freemsg(m)
-#  define      ALLOC_MB_T(m,l) (m) = allocmbt(l)
-#  define      PREP_MB_T(f,m)  ipf_prependmbt(f, m)
-#  define      M_DUP(m)        copymsg(m)
-#  define      m_next          b_cont
-#  define      IPF_PANIC(x,y)  if (x) { printf y; cmn_err(CE_PANIC, "ipf_panic"); }
-typedef mblk_t mb_t;
-extern void    mb_copydata __P((mblk_t *, size_t, size_t, char *));
-extern void    mb_copyback __P((mblk_t *, size_t, size_t, char *));
-# endif /* _KERNEL */
-
-# if (SOLARIS2 >= 7)
-#  ifdef lint
-#   define ALIGN32(ptr)    (ptr ? 0L : 0L)
-#   define ALIGN16(ptr)    (ptr ? 0L : 0L)
-#  else
-#   define ALIGN32(ptr)    (ptr)
-#   define ALIGN16(ptr)    (ptr)
-#  endif
-# endif
-
-# if SOLARIS2 < 6
-typedef        struct uio      uio_t;



Home | Main Index | Thread Index | Old Index