X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=modules%2Fppp_mod.h;h=792c4d4fc5b5feb129dac73df19447d50e785670;hp=e647a6384eb4258ddc37a39fa7a6592993d3cad5;hb=HEAD;hpb=a44a616baa968a263dc273bc06ed79c475b7deec diff --git a/modules/ppp_mod.h b/modules/ppp_mod.h index e647a63..792c4d4 100644 --- a/modules/ppp_mod.h +++ b/modules/ppp_mod.h @@ -2,10 +2,6 @@ * Miscellaneous definitions for PPP STREAMS modules. */ -#if defined(osf) || defined(__osf__) -#define OSF1 -#endif - /* * Macros for allocating and freeing kernel memory. */ @@ -21,37 +17,80 @@ #define ALLOC_SLEEP(n) kmem_alloc((n), KMEM_SLEEP) #define ALLOC_NOSLEEP(n) kmem_alloc((n), KMEM_NOSLEEP) #define FREE(p, n) kmem_free((p), (n)) +#define NOTSUSER() (suser()? 0: EPERM) +#define bcanputnext(q, band) canputnext((q)) #endif /* SunOS 4 */ -#ifdef OSF1 -#include /* OSF/1 */ +#ifdef __osf__ +#include + +/* caution: this mirrors macros in sys/malloc.h, and uses interfaces + * which are subject to change. + * The problems are that: + * - the official MALLOC macro wants the lhs of the assignment as an argument, + * and it takes care of the assignment itself (yuck.) + * - PPP insists on using "FREE" which conflicts with a macro of the same name. + * + */ +#ifdef BUCKETINDX /* V2.0 */ +#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_WAITOK) +#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETP(n), M_DEVBUF, M_NOWAIT) +#else +#define ALLOC_SLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_WAITOK) +#define ALLOC_NOSLEEP(n) (void *)malloc((u_long)(n), BUCKETINDEX(n), M_DEVBUF, M_NOWAIT) +#endif + +#define bcanputnext(q, band) canputnext((q)) + +#ifdef FREE #undef FREE -#define ALLOC_SLEEP(n) kalloc((n)) -#define ALLOC_NOSLEEP(n) kalloc((n)) -#define FREE(p, n) kfree((p), (n)) -#endif /* OSF/1 */ +#endif +#define FREE(p, n) free((void *)(p), M_DEVBUF) + +#define NO_DLPI 1 + +#ifndef IFT_PPP +#define IFT_PPP 0x17 +#endif + +#include +#define NOTSUSER() (suser(u.u_procp->p_rcred, &u.u_acflag) ? EPERM : 0) + +/* #include "ppp_osf.h" */ + +#endif /* __osf__ */ #ifdef AIX4 #define ALLOC_SLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */ #define ALLOC_NOSLEEP(n) xmalloc((n), 0, pinned_heap) /* AIX V4.x */ #define FREE(p, n) xmfree((p), pinned_heap) +#define NOTSUSER() (suser()? 0: EPERM) #endif /* AIX */ /* * Macros for printing debugging stuff. */ #ifdef DEBUG -#ifdef SVR4 +#if defined(SVR4) || defined(__osf__) +#if defined(SNI) +#include +#define STRLOG_ID 4712 +#define DPRINT(f) strlog(STRLOG_ID, 0, 0, SL_TRACE, f) +#define DPRINT1(f, a1) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1) +#define DPRINT2(f, a1, a2) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1, a2) +#define DPRINT3(f, a1, a2, a3) strlog(STRLOG_ID, 0, 0, SL_TRACE, f, a1, a2, a3) +#else #define DPRINT(f) cmn_err(CE_CONT, f) #define DPRINT1(f, a1) cmn_err(CE_CONT, f, a1) #define DPRINT2(f, a1, a2) cmn_err(CE_CONT, f, a1, a2) #define DPRINT3(f, a1, a2, a3) cmn_err(CE_CONT, f, a1, a2, a3) +#endif /* SNI */ #else #define DPRINT(f) printf(f) #define DPRINT1(f, a1) printf(f, a1) #define DPRINT2(f, a1, a2) printf(f, a1, a2) #define DPRINT3(f, a1, a2, a3) printf(f, a1, a2, a3) -#endif /* SVR4 */ +#endif /* SVR4 or OSF */ #else #define DPRINT(f) 0 @@ -63,8 +102,10 @@ #ifndef SVR4 typedef unsigned char uchar_t; typedef unsigned short ushort_t; +#ifndef __osf__ typedef int minor_t; #endif +#endif /* * If we don't have multithreading support, define substitutes. @@ -102,10 +143,10 @@ typedef int minor_t; */ #ifdef SVR4 #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, dev_t *, int, int, cred_t *)) +static int name(queue_t *, dev_t *, int, int, cred_t *) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int, cred_t *)) +static int name(queue_t *, int, cred_t *) #define MOD_OPEN(name) \ static int name(q, devp, flag, sflag, credp) \ @@ -127,10 +168,10 @@ static int name(q, flag, credp) \ #else /* not SVR4 */ #define MOD_OPEN_DECL(name) \ -static int name __P((queue_t *, int, int, int)) +static int name(queue_t *, int, int, int) #define MOD_CLOSE_DECL(name) \ -static int name __P((queue_t *, int)) +static int name(queue_t *, int) #define MOD_OPEN(name) \ static int name(q, dev, flag, sflag) \ @@ -146,11 +187,4 @@ static int name(q, flag) \ #define OPEN_ERROR(x) { u.u_error = (x); return OPENFAIL; } #define DRV_OPEN_OK(dev) return (dev) -#ifdef OSF1 -#include -#define NOTSUSER() (suser(u.u_procp->p_rcred, &u.u_acflag)) -#else -#define NOTSUSER() (suser()? 0: EPERM) -#endif - #endif /* SVR4 */