From: graichen Date: Fri, 31 Jan 1997 14:41:57 +0000 (+0000) Subject: make amd 64bit ready for the alpha (from NetBSD/thorpej) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=874c7d5357e772be708e44e57b391c5808e9f916;p=openbsd make amd 64bit ready for the alpha (from NetBSD/thorpej) --- diff --git a/usr.sbin/amd/amd/amq_subr.c b/usr.sbin/amd/amd/amq_subr.c index 230355d0d47..37e4142fb89 100644 --- a/usr.sbin/amd/amd/amq_subr.c +++ b/usr.sbin/amd/amd/amq_subr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq_subr.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_subr.c,v 1.1.1.1 1995/10/18 08:47:10 deraadt Exp $ + * $Id: amq_subr.c,v 1.2 1997/01/31 14:41:57 graichen Exp $ */ /* @@ -295,7 +295,8 @@ xdr_amq_mount_tree_node(xdrs, objp) if (!xdr_amq_string(xdrs, &mp->am_mnt->mf_ops->fs_type)) { return (FALSE); } - if (!xdr_long(xdrs, &mp->am_stats.s_mtime)) { + /* XXX really a time_t, but need to transmit a 32-bit integer */ + if (!xdr_int(xdrs, (int *)&mp->am_stats.s_mtime)) { return (FALSE); } if (!xdr_u_short(xdrs, &mp->am_stats.s_uid)) { diff --git a/usr.sbin/amd/amd/host_ops.c b/usr.sbin/amd/amd/host_ops.c index f105d28ab15..a1d63d1094e 100644 --- a/usr.sbin/amd/amd/host_ops.c +++ b/usr.sbin/amd/amd/host_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: host_ops.c,v 1.2 1996/03/25 15:54:46 niklas Exp $ */ +/* $OpenBSD: host_ops.c,v 1.3 1997/01/31 14:41:58 graichen Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -154,10 +154,11 @@ mntfs *mf; return mount_nfs_fh(fhp, dir, fs_name, opts, mf); } -static int sortfun P((exports *a, exports *b)); -static int sortfun(a, b) -exports *a,*b; +static int sortfun P((const void *arg1, const void *arg2)); +static int sortfun(arg1, arg2) +const void *arg1, *arg2; { + const exports *a = arg1, *b = arg2; return strcmp((*a)->ex_dir, (*b)->ex_dir); } diff --git a/usr.sbin/amd/amd/info_hes.c b/usr.sbin/amd/amd/info_hes.c index 267e3106f08..45c7b16ac76 100644 --- a/usr.sbin/amd/amd/info_hes.c +++ b/usr.sbin/amd/amd/info_hes.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)info_hes.c 8.1 (Berkeley) 6/6/93 - * $Id: info_hes.c,v 1.1.1.1 1995/10/18 08:47:10 deraadt Exp $ + * $Id: info_hes.c,v 1.2 1997/01/31 14:41:58 graichen Exp $ */ /* @@ -423,7 +423,7 @@ char *msg, *eom; int qdcount, ancount; char key[PACKETSZ]; char *key_cpy, *value, *hs_make_value(); - short type; + int16_t type; hp = (HEADER *)msg; if (hp->rcode != NOERROR || hp->opcode != QUERY) { @@ -452,9 +452,9 @@ char *msg, *eom; if ((type = _getshort(cp)) == T_SOA) { soacnt++; } - cp += 2*sizeof(u_short) + sizeof(u_long); + cp += 2*sizeof(u_int16_t) + sizeof(u_int32_t); len = _getshort(cp); - cp += sizeof(u_short); + cp += sizeof(u_int16_t); /* Check to see if key is in our domain */ if (type == T_TXT && hs_strip_our_domain(key)) { value = hs_make_value(cp, len); diff --git a/usr.sbin/amd/amd/map.c b/usr.sbin/amd/amd/map.c index 3d28fde1a2a..693ffc85d8a 100644 --- a/usr.sbin/amd/amd/map.c +++ b/usr.sbin/amd/amd/map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: map.c,v 1.2 1996/03/25 15:54:48 niklas Exp $ */ +/* $OpenBSD: map.c,v 1.3 1997/01/31 14:41:59 graichen Exp $ */ /*- * Copyright (c) 1990 Jan-Simon Pendry @@ -40,7 +40,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)map.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: map.c,v 1.2 1996/03/25 15:54:48 niklas Exp $"; +static char *rcsid = "$OpenBSD: map.c,v 1.3 1997/01/31 14:41:59 graichen Exp $"; #endif /* not lint */ #include "am.h" @@ -621,10 +621,10 @@ char *dir; * Patch up PID to match main server... */ if (!foreground) { - long pid = getppid(); + pid_t pid = getppid(); ((struct am_fh *) &nfh)->fhh_pid = pid; #ifdef DEBUG - dlog("root_fh substitutes pid %d", pid); + dlog("root_fh substitutes pid %d", (int)pid); #endif } return &nfh; diff --git a/usr.sbin/amd/amd/mount_fs.c b/usr.sbin/amd/amd/mount_fs.c index 3cd9b61f82c..1374383df74 100644 --- a/usr.sbin/amd/amd/mount_fs.c +++ b/usr.sbin/amd/amd/mount_fs.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)mount_fs.c 8.1 (Berkeley) 6/6/93 - * $Id: mount_fs.c,v 1.3 1997/01/21 17:14:42 bitblt Exp $ + * $Id: mount_fs.c,v 1.4 1997/01/31 14:42:00 graichen Exp $ */ #include "am.h" @@ -173,12 +173,12 @@ again: xopts = mnt->mnt_opts; if (sizeof(stb.st_dev) == 2) { /* e.g. SunOS 4.1 */ - sprintf(zopts, "%s,%s=%s%04lx", xopts, MNTINFO_DEV, - MNTINFO_PREF, (u_long) stb.st_dev & 0xffff); + sprintf(zopts, "%s,%s=%s%04x", xopts, MNTINFO_DEV, + MNTINFO_PREF, (u_int) stb.st_dev & 0xffff); } else { /* e.g. System Vr4 */ - sprintf(zopts, "%s,%s=%s%08lx", xopts, MNTINFO_DEV, - MNTINFO_PREF, (u_long) stb.st_dev); + sprintf(zopts, "%s,%s=%s%08x", xopts, MNTINFO_DEV, + MNTINFO_PREF, (u_int) stb.st_dev); } mnt->mnt_opts = zopts; } diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c index 4cc50e4bc93..d739d465dea 100644 --- a/usr.sbin/amd/amd/nfs_ops.c +++ b/usr.sbin/amd/amd/nfs_ops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_ops.c,v 1.5 1996/05/24 09:22:06 deraadt Exp $ */ +/* $OpenBSD: nfs_ops.c,v 1.6 1997/01/31 14:42:00 graichen Exp $ */ /*- * Copyright (c) 1990 Jan-Simon Pendry @@ -40,7 +40,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)nfs_ops.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.5 1996/05/24 09:22:06 deraadt Exp $"; +static char *rcsid = "$OpenBSD: nfs_ops.c,v 1.6 1997/01/31 14:42:00 graichen Exp $"; #endif /* not lint */ #include "am.h" @@ -126,7 +126,8 @@ voidp idv; int done; { fh_cache *fp, *fp2 = 0; - int id = (int) idv; + /* XXX EVIL XXX */ + int id = (int) ((long)idv); ITER(fp, fh_cache, &fh_head) { if (fp->fh_id == id) { @@ -388,9 +389,13 @@ voidp wchan; len = make_rpc_packet(iobuf, sizeof(iobuf), proc, &mnt_msg, (voidp) &fp->fh_path, xdr_nfspath, nfs_auth); + /* + * XXX EVIL! We case fh_id to a pointer, then back to an int + * XXX later. + */ if (len > 0) { error = fwd_packet(MK_RPC_XID(RPC_XID_MOUNTD, fp->fh_id), - (voidp) iobuf, len, &fp->fh_sin, &fp->fh_sin, (voidp) fp->fh_id, f); + (voidp) iobuf, len, &fp->fh_sin, &fp->fh_sin, (voidp) ((long)fp->fh_id), f); } else { error = -len; } diff --git a/usr.sbin/amd/amd/nfs_start.c b/usr.sbin/amd/amd/nfs_start.c index 32189a3b454..6d2ce3ab128 100644 --- a/usr.sbin/amd/amd/nfs_start.c +++ b/usr.sbin/amd/amd/nfs_start.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)nfs_start.c 8.1 (Berkeley) 6/6/93 - * $Id: nfs_start.c,v 1.1.1.1 1995/10/18 08:47:11 deraadt Exp $ + * $Id: nfs_start.c,v 1.2 1997/01/31 14:42:01 graichen Exp $ */ #include "am.h" @@ -92,10 +92,10 @@ static char *max_mem = 0; /*if (max_mem == 0) { max_mem = next_mem; } else*/ if (max_mem < next_mem) { - dlog("%#x bytes of memory allocated; total is %#x (%d pages)", - next_mem - max_mem, - next_mem, - ((int)next_mem+getpagesize()-1)/getpagesize()); + dlog("%#lx bytes of memory allocated; total is %#lx (%ld pages)", + (unsigned long)(next_mem - max_mem), + (unsigned long)next_mem, + ((unsigned long)next_mem+getpagesize()-1)/getpagesize()); max_mem = next_mem; } } diff --git a/usr.sbin/amd/amd/srvr_nfs.c b/usr.sbin/amd/amd/srvr_nfs.c index 26331299e19..de5984c15ee 100644 --- a/usr.sbin/amd/amd/srvr_nfs.c +++ b/usr.sbin/amd/amd/srvr_nfs.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)srvr_nfs.c 8.1 (Berkeley) 6/6/93 - * $Id: srvr_nfs.c,v 1.1.1.1 1995/10/18 08:47:12 deraadt Exp $ + * $Id: srvr_nfs.c,v 1.2 1997/01/31 14:42:02 graichen Exp $ */ /* @@ -275,7 +275,8 @@ struct sockaddr_in *tsp; voidp idv; int done; { - int xid = (int) idv; + /* XXX EVIL! XXX */ + int xid = (int) ((long)idv); fserver *fs; #ifdef DEBUG int found_map = 0; @@ -461,8 +462,12 @@ fserver *fs; /* * Queue the packet... */ + /* + * XXX EVIL! We cast xid to a pointer, then back to an int when + * XXX we get the reply. + */ error = fwd_packet(MK_RPC_XID(RPC_XID_NFSPING, np->np_xid), (voidp) ping_buf, - ping_len, fs->fs_ip, (struct sockaddr_in *) 0, (voidp) np->np_xid, nfs_pinged); + ping_len, fs->fs_ip, (struct sockaddr_in *) 0, (voidp) ((long)np->np_xid), nfs_pinged); /* * See if a hard error occured diff --git a/usr.sbin/amd/amd/util.c b/usr.sbin/amd/amd/util.c index e64c53df3b0..d7e3db73843 100644 --- a/usr.sbin/amd/amd/util.c +++ b/usr.sbin/amd/amd/util.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)util.c 8.1 (Berkeley) 6/6/93 - * $Id: util.c,v 1.2 1996/08/10 21:39:43 deraadt Exp $ + * $Id: util.c,v 1.3 1997/01/31 14:42:02 graichen Exp $ */ /* @@ -242,10 +242,10 @@ char **chp; * addr is in network byte order. * sizeof(buf) needs to be at least 16. */ -char *inet_dquad P((char *buf, unsigned long addr)); +char *inet_dquad P((char *buf, u_int32_t addr)); char *inet_dquad(buf, addr) char *buf; -unsigned long addr; +u_int32_t addr; { addr = ntohl(addr); sprintf(buf, "%d.%d.%d.%d", diff --git a/usr.sbin/amd/amd/wire.c b/usr.sbin/amd/amd/wire.c index 0b4395e5cdc..cb246fb7d9c 100644 --- a/usr.sbin/amd/amd/wire.c +++ b/usr.sbin/amd/amd/wire.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)wire.c 8.1 (Berkeley) 6/6/93 - * $Id: wire.c,v 1.1.1.1 1995/10/18 08:47:12 deraadt Exp $ + * $Id: wire.c,v 1.2 1997/01/31 14:42:03 graichen Exp $ */ /* @@ -63,8 +63,8 @@ typedef struct addrlist addrlist; struct addrlist { addrlist *ip_next; - unsigned long ip_addr; - unsigned long ip_mask; + u_int32_t ip_addr; + u_int32_t ip_mask; }; static addrlist *localnets = 0; @@ -91,7 +91,7 @@ char *getwire() struct ifconf ifc; struct ifreq *ifr; caddr_t cp, cplim; - unsigned long address, netmask, subnet; + u_int32_t address, netmask, subnet; char buf[GFBUFLEN], *s; int sk = -1; char *netname = 0; @@ -176,9 +176,9 @@ char *getwire() localnets = al; if (netname == 0) { - unsigned long net; - unsigned long mask; - unsigned long subnetshift; + u_int32_t net; + u_int32_t mask; + u_int32_t subnetshift; /* * Figure out the subnet's network address */ @@ -260,9 +260,9 @@ char *getwire() * Determine whether a network is on a local network * (addr) is in network byte order. */ -int islocalnet P((unsigned long addr)); +int islocalnet P((u_int32_t addr)); int islocalnet(addr) -unsigned long addr; +u_int32_t addr; { addrlist *al; diff --git a/usr.sbin/amd/amd/xutil.c b/usr.sbin/amd/amd/xutil.c index 6134bb96d65..dc49f050830 100644 --- a/usr.sbin/amd/amd/xutil.c +++ b/usr.sbin/amd/amd/xutil.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)xutil.c 8.1 (Berkeley) 6/6/93 - * $Id: xutil.c,v 1.1.1.1 1995/10/18 08:47:12 deraadt Exp $ + * $Id: xutil.c,v 1.2 1997/01/31 14:42:04 graichen Exp $ */ #include "config.h" @@ -47,6 +47,8 @@ #include #endif +#include + FILE *logfp = stderr; /* Log errors to stderr initially */ #ifdef HAS_SYSLOG int syslogging; diff --git a/usr.sbin/amd/fsinfo/fsi_data.h b/usr.sbin/amd/fsinfo/fsi_data.h index 95886292b40..5a25c3350bc 100644 --- a/usr.sbin/amd/fsinfo/fsi_data.h +++ b/usr.sbin/amd/fsinfo/fsi_data.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)fsi_data.h 8.1 (Berkeley) 6/6/93 - * $Id: fsi_data.h,v 1.1.1.1 1995/10/18 08:47:18 deraadt Exp $ + * $Id: fsi_data.h,v 1.2 1997/01/31 14:42:10 graichen Exp $ */ typedef struct auto_tree auto_tree; @@ -120,7 +120,7 @@ struct ether_if { #define EF_INADDR 0 struct in_addr e_inaddr; #define EF_NETMASK 1 - u_long e_netmask; + u_int32_t e_netmask; #define EF_HWADDR 2 char *e_hwaddr; }; diff --git a/usr.sbin/amd/fsinfo/fsi_util.c b/usr.sbin/amd/fsinfo/fsi_util.c index df1bfdb59d3..88b0179955d 100644 --- a/usr.sbin/amd/fsinfo/fsi_util.c +++ b/usr.sbin/amd/fsinfo/fsi_util.c @@ -33,7 +33,7 @@ * SUCH DAMAGE. * * from: @(#)fsi_util.c 8.1 (Berkeley) 6/6/93 - * $Id: fsi_util.c,v 1.1.1.1 1995/10/18 08:47:18 deraadt Exp $ + * $Id: fsi_util.c,v 1.2 1997/01/31 14:42:11 graichen Exp $ */ #include "../fsinfo/fsinfo.h" @@ -83,6 +83,7 @@ char *s, *s1, *s2, *s3, *s4; exit(1); } +#ifndef __NetBSD__ /* * Dup a string */ @@ -97,6 +98,7 @@ char *s; return sp; } +#endif /* __NetBSD__ */ /* * Debug log @@ -419,8 +421,8 @@ char *v; free(v); } break; case EF_NETMASK: { - u_long nm = 0; - if ((sscanf(v, "0x%lx", &nm) == 1 || sscanf(v, "%lx", &nm) == 1) && nm != 0) + u_int32_t nm = 0; + if ((sscanf(v, "0x%x", &nm) == 1 || sscanf(v, "%x", &nm) == 1) && nm != 0) ep->e_netmask = htonl(nm); else yyerror("malformed netmask: %s", v); diff --git a/usr.sbin/amd/fsinfo/fsinfo.h b/usr.sbin/amd/fsinfo/fsinfo.h index 4c7259dcd72..077d9f8145d 100644 --- a/usr.sbin/amd/fsinfo/fsinfo.h +++ b/usr.sbin/amd/fsinfo/fsinfo.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)fsinfo.h 8.1 (Berkeley) 6/6/93 - * $Id: fsinfo.h,v 1.1.1.1 1995/10/18 08:47:19 deraadt Exp $ + * $Id: fsinfo.h,v 1.2 1997/01/31 14:42:11 graichen Exp $ */ /* @@ -82,11 +82,11 @@ typedef char *voidp; #include #include +#include +#include + #include "fsi_data.h" -extern char* strchr P((Const char*, int)); /* C */ -extern char* strrchr P((Const char*, int)); /* C */ -extern char *strdup P((char*)); /* C */ extern void fatal(); extern void warning(); extern void error(); diff --git a/usr.sbin/amd/include/am.h b/usr.sbin/amd/include/am.h index 48aa07706e3..48ed7bfa256 100644 --- a/usr.sbin/amd/include/am.h +++ b/usr.sbin/amd/include/am.h @@ -1,4 +1,4 @@ -/* $OpenBSD: am.h,v 1.2 1996/03/25 15:54:54 niklas Exp $ */ +/* $OpenBSD: am.h,v 1.3 1997/01/31 14:42:18 graichen Exp $ */ /* * Copyright (c) 1990 Jan-Simon Pendry @@ -49,6 +49,8 @@ #include #include #include +#include +#include #ifdef MNTENT_HDR #include MNTENT_HDR #endif /* MNTENT_HDR */ @@ -257,11 +259,11 @@ extern char *hasmntopt P((struct mntent*, char*)); #endif /* NEED_MNTOPT_PARSER */ extern int hasmntval P((struct mntent*, char*)); extern void host_normalize P((char **)); -extern char *inet_dquad P((char*, unsigned long)); +extern char *inet_dquad P((char*, u_int32_t)); extern void init_map P((am_node*, char*)); extern void insert_am P((am_node*, am_node*)); extern void ins_que P((qelem*, qelem*)); -extern int islocalnet P((unsigned long)); +extern int islocalnet P((u_int32_t)); extern int make_nfs_auth P((void)); extern void make_root_node(P_void); extern int make_rpc_packet P((char*, int, u_long, struct rpc_msg*, voidp, xdrproc_t, AUTH*)); @@ -311,7 +313,6 @@ extern char* str3cat P((char*, char*, char*, char*)); extern char* strcat P((char*, Const char*)); /* C */ extern int strcmp P((Const char*, Const char*)); /* C */ extern char* strdup P((Const char*)); -extern int strlen P((Const char*)); /* C */ extern char* strnsave P((Const char*, int)); extern char* strrchr P((Const char*, int)); /* C */ extern char* strealloc P((char*, char *)); diff --git a/usr.sbin/amd/rpcx/amq.h b/usr.sbin/amd/rpcx/amq.h index 1db3876ce83..77d798456e4 100644 --- a/usr.sbin/amd/rpcx/amq.h +++ b/usr.sbin/amd/rpcx/amq.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq.h 8.1 (Berkeley) 6/6/93 - * $Id: amq.h,v 1.1.1.1 1995/10/18 08:47:22 deraadt Exp $ + * $Id: amq.h,v 1.2 1997/01/31 14:42:22 graichen Exp $ * */ @@ -46,7 +46,7 @@ typedef char *amq_string; bool_t xdr_amq_string(); -typedef long *time_type; +typedef int *time_type; bool_t xdr_time_type(); diff --git a/usr.sbin/amd/rpcx/amq.x b/usr.sbin/amd/rpcx/amq.x index 5334e48566f..82d5e2a05c5 100644 --- a/usr.sbin/amd/rpcx/amq.x +++ b/usr.sbin/amd/rpcx/amq.x @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq.x 8.1 (Berkeley) 6/6/93 - * $Id: amq.x,v 1.1.1.1 1995/10/18 08:47:22 deraadt Exp $ + * $Id: amq.x,v 1.2 1997/01/31 14:42:22 graichen Exp $ * */ @@ -53,8 +53,9 @@ typedef string amq_string; /* * The type time_type should correspond to the system time_t + * XXX int/long time_t garbage; this needs to be a 32-bit integer */ -typedef long time_type; +typedef int time_type; /* * A tree of what is mounted diff --git a/usr.sbin/amd/rpcx/amq_xdr.c b/usr.sbin/amd/rpcx/amq_xdr.c index 8f0bbd98d0c..35c8fe424d9 100644 --- a/usr.sbin/amd/rpcx/amq_xdr.c +++ b/usr.sbin/amd/rpcx/amq_xdr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq_xdr.c 8.1 (Berkeley) 6/6/93 - * $Id: amq_xdr.c,v 1.1.1.1 1995/10/18 08:47:23 deraadt Exp $ + * $Id: amq_xdr.c,v 1.2 1997/01/31 14:42:23 graichen Exp $ * */ @@ -63,7 +63,7 @@ xdr_time_type(xdrs, objp) XDR *xdrs; time_type *objp; { - if (!xdr_long(xdrs, (long *) objp)) { + if (!xdr_int(xdrs, (int *) objp)) { return (FALSE); } return (TRUE);