]> git.ozlabs.org Git - ppp.git/commitdiff
mods for OSF/1
authorPaul Mackerras <paulus@samba.org>
Wed, 26 Jun 1996 00:53:17 +0000 (00:53 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 26 Jun 1996 00:53:17 +0000 (00:53 +0000)
modules/bsd-comp.c
modules/deflate.c
modules/ppp_mod.h
modules/vjcompress.c

index d9e9fe9f1a7764c85cb8a5ce5c38116fd1f95201..3d89d70ee7e37f05ad251586c5b40fecfd7db83b 100644 (file)
@@ -39,9 +39,9 @@
 
 /*
  * This version is for use with STREAMS under SunOS 4.x,
- * DEC Alpha OSF/1, AIX 4.x, and SVR4 systems including Solaris 2.
+ * Digital UNIX, AIX 4.x, and SVR4 systems including Solaris 2.
  *
- * $Id: bsd-comp.c,v 1.18 1996/01/18 03:12:53 paulus Exp $
+ * $Id: bsd-comp.c,v 1.19 1996/06/26 00:53:15 paulus Exp $
  */
 
 #ifdef AIX4
@@ -60,7 +60,7 @@
 #endif
 #endif
 
-#ifdef OSF1
+#ifdef __osf__
 #undef FIRST
 #undef LAST
 #define BSD_LITTLE_ENDIAN
@@ -326,6 +326,7 @@ bsd_alloc(options, opt_len, decomp)
     if (opt_len != 3 || options[0] != CI_BSD_COMPRESS || options[1] != 3
        || BSD_VERSION(options[2]) != BSD_CURRENT_VERSION)
        return NULL;
+
     bits = BSD_NBITS(options[2]);
     switch (bits) {
     case 9:                    /* needs 82152 for both directions */
@@ -357,7 +358,11 @@ bsd_alloc(options, opt_len, decomp)
 
     maxmaxcode = MAXCODE(bits);
     newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
+#ifdef __osf__
+    db = (struct bsd_db *) ALLOC_SLEEP(newlen);
+#else
     db = (struct bsd_db *) ALLOC_NOSLEEP(newlen);
+#endif
     if (!db)
        return NULL;
     bzero(db, sizeof(*db) - sizeof(db->dict));
@@ -365,7 +370,11 @@ bsd_alloc(options, opt_len, decomp)
     if (!decomp) {
        db->lens = NULL;
     } else {
+#ifdef __osf__
+       db->lens = (u_short *) ALLOC_SLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
+#else
        db->lens = (u_short *) ALLOC_NOSLEEP((maxmaxcode+1) * sizeof(db->lens[0]));
+#endif
        if (!db->lens) {
            FREE(db, newlen);
            return NULL;
index 57294a9503a94215d1682f7253733c7f512669ba..c285b47fd7b5d13a14c8305fe9767c6a09a43caa 100644 (file)
@@ -27,7 +27,7 @@
  * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
  * OR MODIFICATIONS.
  *
- * $Id: deflate.c,v 1.2 1996/04/04 02:44:56 paulus Exp $
+ * $Id: deflate.c,v 1.3 1996/06/26 00:53:16 paulus Exp $
  */
 
 #ifdef AIX4
 
 #define PACKETPTR      mblk_t *
 #include <net/ppp-comp.h>
+
+#ifdef __osf__
+#include "zlib.h"
+#else
 #include "common/zlib.h"
+#endif
 
 #if DO_DEFLATE
 
@@ -61,8 +66,8 @@ struct deflate_state {
 
 #define DEFLATE_OVHD   2               /* Deflate overhead/packet */
 
-static void    *zalloc __P((void *, u_int items, u_int size));
-static void    zfree __P((void *, void *ptr, u_int nb));
+static void    *z_alloc __P((void *, u_int items, u_int size));
+static void    z_free __P((void *, void *ptr, u_int nb));
 static void    *z_comp_alloc __P((u_char *options, int opt_len));
 static void    *z_decomp_alloc __P((u_char *options, int opt_len));
 static void    z_comp_free __P((void *state));
@@ -106,15 +111,19 @@ struct compressor ppp_deflate = {
  * Space allocation and freeing routines for use by zlib routines.
  */
 static void *
-zalloc(notused, items, size)
+z_alloc(notused, items, size)
     void *notused;
     u_int items, size;
 {
+#ifdef __osf__
+    return ALLOC_SLEEP(items * size);
+#else
     return ALLOC_NOSLEEP(items * size);
+#endif
 }
 
 static void
-zfree(notused, ptr, nbytes)
+z_free(notused, ptr, nbytes)
     void *notused;
     void *ptr;
     u_int nbytes;
@@ -147,8 +156,8 @@ z_comp_alloc(options, opt_len)
        return NULL;
 
     state->strm.next_in = NULL;
-    state->strm.zalloc = (alloc_func) zalloc;
-    state->strm.zfree = (free_func) zfree;
+    state->strm.zalloc = (alloc_func) z_alloc;
+    state->strm.zfree = (free_func) z_free;
     if (deflateInit2(&state->strm, Z_DEFAULT_COMPRESSION, DEFLATE_METHOD_VAL,
                     -w_size, 8, Z_DEFAULT_STRATEGY, DEFLATE_OVHD+2) != Z_OK) {
        FREE(state, sizeof(*state));
@@ -379,8 +388,8 @@ z_decomp_alloc(options, opt_len)
        return NULL;
 
     state->strm.next_out = NULL;
-    state->strm.zalloc = (alloc_func) zalloc;
-    state->strm.zfree = (free_func) zfree;
+    state->strm.zalloc = (alloc_func) z_alloc;
+    state->strm.zfree = (free_func) z_free;
     if (inflateInit2(&state->strm, -w_size) != Z_OK) {
        FREE(state, sizeof(*state));
        return NULL;
index e647a6384eb4258ddc37a39fa7a6592993d3cad5..59b940f62a4b8e70181cbd8fb0ebba8c5809baf6 100644 (file)
@@ -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.
  */
@@ -14,6 +10,7 @@
 #define ALLOC_SLEEP(n)         kmem_alloc((n), KM_SLEEP)
 #define ALLOC_NOSLEEP(n)       kmem_alloc((n), KM_NOSLEEP)
 #define FREE(p, n)             kmem_free((p), (n))
+#define NOTSUSER()             (suser()? 0: EPERM)
 #endif
 
 #ifdef SUNOS4
 #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)
 #endif /* SunOS 4 */
 
-#ifdef OSF1
-#include <kern/kalloc.h>       /* OSF/1 */
+#ifdef __osf__
+#include <sys/malloc.h>
+
+/* 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
+
+#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 <sys/proc.h>
+#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__)
 #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)
 #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.
@@ -146,11 +176,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 <sys/proc.h>
-#define NOTSUSER()     (suser(u.u_procp->p_rcred, &u.u_acflag))
-#else
-#define NOTSUSER()     (suser()? 0: EPERM)
-#endif
-
 #endif /* SVR4 */
index eecbef5b35868589936692ce02783d0ac7da2546..66d3402886c22cdd81dc27b7996a81e1e7a150c6 100644 (file)
  */
 
 /*
- * This version is used under SunOS 4.x, DEC Alpha OSF/1, AIX 4.x,
+ * This version is used under SunOS 4.x, Digital UNIX, AIX 4.x,
  * and SVR4 systems including Solaris 2.
  *
- * $Id: vjcompress.c,v 1.8 1996/05/24 07:04:26 paulus Exp $
+ * $Id: vjcompress.c,v 1.9 1996/06/26 00:53:17 paulus Exp $
  */
 
 #include <sys/types.h>
@@ -44,7 +44,7 @@
 #endif
 #endif
 
-#ifdef OSF1
+#ifdef __osf__
 #include <net/net_globals.h>
 #endif
 #include <netinet/in.h>
@@ -75,7 +75,7 @@ typedef u_long  n_long;
 #define ovbcopy bcopy
 #endif
 
-#ifdef OSF1
+#ifdef __osf__
 #define getip_hl(base) (((base).ip_vhl)&0xf)
 #define getth_off(base)        ((((base).th_xoff)&0xf0)>>4)