Article View: mod.protocols.appletalk
Article #252Submission for mod-protocols-appletalk
From: hedrick
Date: Fri, 13 Mar 1987 09:01
Date: Fri, 13 Mar 1987 09:01
376 lines
9848 bytes
9848 bytes
Path: topaz!hedrick
From: hedrick@topaz.RUTGERS.EDU (Charles Hedrick)
Newsgroups: mod.protocols.appletalk
Subject: CAP for Pyramid
Message-ID: <10071@topaz.RUTGERS.EDU>
Date: 13 Mar 87 09:00:59 GMT
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 367
We are currently using EFS and PAPIP on a Pyramid 98x, on an
experimental basis. I thought the results would be interesting
both to other Pyramid sites and people with other machines that
have alignment problems. There were two classes of problems:
1) alignment problems. On the Pyramid, 16 bit things must be on
16 bit boundaries and 32 bit things on 32 bit boundaries. I added
an ifdef pyr to handle alignment. Note that all routines must be
compiled with -q on the Pyramid. This causes fields to be allocated
as on the VAX. Otherwise padding bytes are added so that half words
and full words begin the right place. When -q is used, the compiler
compiles code to pull out individual bytes and put them together,
i.e. it handles alignment problems. A couple of patches were still
needed because of the use of casts in ways that fool the compiler.
In the process, I repaired some code that seemed to be an attempt
to fix alignment for the PC RT. If your machine does not have
the equivalent of Pyramid's -q, but does have alignment requirements,
porting this code is likely to be quite interesting.
2) a problem with finderInfo being used as both a struct name and
a field name. I assume this is really a Pyramid compiler bug, but
I'm not enough of a C expert to be sure.
*** abatp.c.ORIG Mon Jan 26 17:48:04 1987
--- abatp.c Tue Mar 10 23:36:56 1987
***************
*** 396,402
int len;
AddrBlock *addr;
{
! #ifdef sun
ATP catp; /* aligned copy of atp */
#endif
ATP *atp;
--- 396,402 -----
int len;
AddrBlock *addr;
{
! #if defined(sun) || defined (pyr)
ATP catp; /* aligned copy of atp */
#endif
ATP *atp;
***************
*** 407,413
if (len < atpSize || type != ddpATP)
return; /* drop it */
! #ifdef sun
bcopy(p, &catp, atpSize);
atp = &catp;
#else
--- 407,413 -----
if (len < atpSize || type != ddpATP)
return; /* drop it */
! #if defined(sun) || defined(pyr)
bcopy(p, &catp, atpSize);
atp = &catp;
#else
*** abddp.c.ORIG Mon Jan 26 17:48:12 1987
--- abddp.c Wed Mar 11 01:29:24 1987
***************
*** 160,165
word chksum;
#endif
#endif BBN
dpr = &abr->proto.ddp;
dstskt = htons(ddp2ipskt(dpr->ddpAddress.skt));
--- 160,166 -----
word chksum;
#endif
#endif BBN
+ struct in_addr d_addr;
dpr = &abr->proto.ddp;
dstskt = htons(ddp2ipskt(dpr->ddpAddress.skt));
***************
*** 192,198
desthost = ipaddr_src;
else
desthost = bridge_addr;
! return(abwrite(desthost, dstskt, iov, iovl));
}
/*ARGSUSED*/
--- 193,200 -----
desthost = ipaddr_src;
else
desthost = bridge_addr;
! d_addr.s_addr = desthost;
! return(abwrite(d_addr, dstskt, iov, iovl));
}
/*ARGSUSED*/
***************
*** 229,236
* DDPOpenSocket call.
*
*/
! #if defined(ibm032) /* rt */
! # define xddp(mem) ddp.mem
#else
# define xddp(mem) ddp->mem
#endif
--- 231,238 -----
* DDPOpenSocket call.
*
*/
! #if defined(ibm032) || defined(pyr) /* rt */
! # define xddp(mem) data.mem
#else
# define xddp(mem) ddp->mem
#endif
***************
*** 234,239
#else
# define xddp(mem) ddp->mem
#endif
ddp_protocol(ddp,len)
DDP *ddp;
int len;
--- 236,242 -----
#else
# define xddp(mem) ddp->mem
#endif
+
ddp_protocol(ddp,len)
DDP *ddp;
int len;
***************
*** 247,254
word chksum;
#endif
#endif DONT_DOCHKSUM
! #if defined(ibm032)
! DDP ddp;
#endif
#if defined(ibm032)
--- 250,257 -----
word chksum;
#endif
#endif DONT_DOCHKSUM
! #if defined(ibm032) || defined(pyr)
! DDP data;
#endif
#if defined(ibm032) || defined(pyr)
***************
*** 251,258
DDP ddp;
#endif
! #if defined(ibm032)
! bcopy(data, &ddp, ddpSize);
#endif
#ifndef DONT_DOCHKSUM
--- 254,261 -----
DDP data;
#endif
! #if defined(ibm032) || defined(pyr)
! bcopy(ddp, &data, ddpSize);
#endif
#ifndef DONT_DOCHKSUM
***************
*** 257,263
#ifndef DONT_DOCHKSUM
if (xddp(checksum) != 0) {
! ddp_chksum(&xddp(dstNet), len-4, 0, chksum);
if (chksum == 0) chksum = 0xffff;
if (ntohs(xddp(checksum)) != chksum) {
fprintf(stderr,"Checksum error: Incoming: %x, calculated %x [%d.%d]\n",
--- 260,266 -----
#ifndef DONT_DOCHKSUM
if (xddp(checksum) != 0) {
! ddp_chksum(&ddp->dstNet, len-4, 0, chksum);
if (chksum == 0) chksum = 0xffff;
if (ntohs(xddp(checksum)) != chksum) {
fprintf(stderr,"Checksum error: Incoming: %x, calculated %x [%d.%d]\n",
***************
*** 286,294
addr.net = xddp(srcNet);
addr.node = xddp(srcNode);
addr.skt = xddp(srcSkt);
- #if defined(ibm032)
- p = ((byte *) data)+ddpSize;
- #else
p = ((byte *) ddp)+ddpSize;
#endif rt
/* transfer to listener */
--- 289,294 -----
addr.net = xddp(srcNet);
addr.node = xddp(srcNode);
addr.skt = xddp(srcSkt);
p = ((byte *) ddp)+ddpSize;
/* transfer to listener */
(*ddpl[skt].lproc)(skt,xddp(type),p,len-ddpSize,&addr);
***************
*** 290,296
p = ((byte *) data)+ddpSize;
#else
p = ((byte *) ddp)+ddpSize;
- #endif rt
/* transfer to listener */
(*ddpl[skt].lproc)(skt,xddp(type),p,len-ddpSize,&addr);
}
--- 290,295 -----
addr.node = xddp(srcNode);
addr.skt = xddp(srcSkt);
p = ((byte *) ddp)+ddpSize;
/* transfer to listener */
(*ddpl[skt].lproc)(skt,xddp(type),p,len-ddpSize,&addr);
}
*** efs.h.ORIG Mon Mar 9 22:35:11 1987
--- efs.h Mon Mar 9 22:38:37 1987
***************
*** 24,30
long resEOF; /* l/p end of resource fork */
long mdDate; /* file modification date */
long crDate; /* file creation date */
! char finderInfo[16]; /* finder info */
char fName; /* length byte of file name */
};
#define FISIZE 33 /* size of above (avoid sizeof() problems) */
--- 24,30 -----
long resEOF; /* l/p end of resource fork */
long mdDate; /* file modification date */
long crDate; /* file creation date */
! char finderInfoData[16]; /* finder info */
char fName; /* length byte of file name */
};
#define FISIZE 33 /* size of above (avoid sizeof() problems) */
*** efsd.c.ORIG Mon Jan 26 17:49:24 1987
--- efsd.c Wed Mar 11 18:49:01 1987
***************
*** 1143,1148
kp->node = node;
}
#endif ONECHILD
/*
* addFileInfo - put information on a file in a FileInfo structure
*
--- 1143,1155 -----
kp->node = node;
}
#endif ONECHILD
+
+ #ifdef pyr
+ #define cplong(a,b) {long tmp=b; bcopy(&tmp, &a, 4);}
+ #else
+ #define cplong(a,b) a = b
+ #endif
+
/*
* addFileInfo - put information on a file in a FileInfo structure
*
***************
*** 1169,1175
bzero(fi, sizeof(*fi));
! if (read(fd, fi->finderInfo, sizeof(fi->finderInfo)) < 0) {
close(fd);
return(0);
}
--- 1176,1182 -----
bzero(fi, sizeof(*fi));
! if (read(fd, fi->finderInfoData, sizeof(fi->finderInfoData)) < 0) {
close(fd);
return(0);
}
***************
*** 1174,1180
return(0);
}
fstat(fd, &statb);
! fi->crDate = htonl(mac_date(statb.st_mtime));
close(fd);
strcpy(cp, ".DF");
--- 1181,1187 -----
return(0);
}
fstat(fd, &statb);
! cplong (fi->crDate, htonl(mac_date(statb.st_mtime)));
close(fd);
strcpy(cp, ".DF");
***************
*** 1180,1186
strcpy(cp, ".DF");
if (stat(fn, &statb) < 0)
return(0);
! fi->dataEOF = htonl(statb.st_size);
strcpy(cp, ".RF");
if (stat(fn, &statb) < 0)
--- 1187,1193 -----
strcpy(cp, ".DF");
if (stat(fn, &statb) < 0)
return(0);
! cplong (fi->dataEOF, htonl(statb.st_size));
strcpy(cp, ".RF");
if (stat(fn, &statb) < 0)
***************
*** 1185,1191
strcpy(cp, ".RF");
if (stat(fn, &statb) < 0)
return(0);
! fi->resEOF = htonl (statb.st_size);
fi->mdDate = htonl(mac_date(statb.st_mtime));
--- 1192,1198 -----
strcpy(cp, ".RF");
if (stat(fn, &statb) < 0)
return(0);
! cplong (fi->resEOF, htonl (statb.st_size));
cplong (fi->mdDate, htonl(mac_date(statb.st_mtime)));
***************
*** 1187,1193
return(0);
fi->resEOF = htonl (statb.st_size);
! fi->mdDate = htonl(mac_date(statb.st_mtime));
*cp = '\0'; /* remove extension from file name */
cp = &fi->fName + 1;
--- 1194,1200 -----
return(0);
cplong (fi->resEOF, htonl (statb.st_size));
! cplong (fi->mdDate, htonl(mac_date(statb.st_mtime)));
*cp = '\0'; /* remove extension from file name */
cp = &fi->fName + 1;
Technical Details
Message-ID:
<8703130901.AA00653@topaz.rutgers.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!TOPAZ.RUTGERS.EDU!hedrickShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ucbvax!TOPAZ.RUTGERS.EDU!hedrick From: hedrick@TOPAZ.RUTGERS.EDU.UUCP Newsgroups: mod.protocols.appletalk Subject: Submission for mod-protocols-appletalk Message-ID: <8703130901.AA00653@topaz.rutgers.edu> Date: Fri, 13-Mar-87 04:01:00 EST Article-I.D.: topaz.8703130901.AA00653 Posted: Fri Mar 13 04:01:00 1987 Date-Received: Sat, 14-Mar-87 06:44:18 EST Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 376 Approved: info-applebus@c.cs.cmu.edu