From d88-skl@nada.kth.se Sun Sep 29 01:14:45 1991
From: d88-skl@nada.kth.se (Stellan Klebom)
Newsgroups: comp.sys.amiga.datacomm
Subject: Re: DNet 2.20 snfs & nfs-handler
Date: 18 Sep 91 03:48:29 GMT
Reply-To: d88-skl@nada.kth.se (Stellan Klebom)
Organization: Royal Institute of Technology, Stockholm, Sweden

In article <432469974@bluemoon.GUN.de>, georg@bluemoon.GUN.de (Georg Sassen) writes:
|> In <91256.10163932KKG6I@CMUVM.BITNET> 32KKG6I@CMUVM.BITNET (Jim Getzinger) writes:
|> 
|> >Has anyone been able to make the nfs handler and snfs work on a Sun
|> >Sparc?   I'm able to start snfs in the background and successfully
|> >mount NF0: (or NFS:) but when I do a dir on NF0:, all I get is one
|> >directory entry.  When it is at the root, I get lost+found only.
|> 
|> Yes, there was a problem with alignement of a struct's entries, I think.
|> 
|> >I could not get the snfs.c in the normal dist to connect, but the version
|> >I found at the dnet/. level allowed the connect, but would give me
|> >the above problem.
|> 
|> Yes, in the snfs.c at the dnet/. level, the alignement problem was fixed but
|> something other went wrong.
|> 
|> >Any suggestions?  Thanks in advance!
|> 
|> Try this one (apply it to the origininal snfs.c in dnet/unix/server), it
|> works fine for me:

I found that the original dnet/unix/server/snfs.c worked fine on sun3. The
snfs.c at dnet/snfs.c works fine under Ultrix. The problem with dnet/snfs.c
is the lton and ntol funktions. They aren't portable between different
endian systems. For suns they can be replaced with null macros. I have
rewritten the functions to find which endian the excuting machines has, so
that the code works in both cases. Replace the two functions in the end of
the file, and compile! :)

         Have fun!


      Stellan Klebom

-----------------------------------------------------------------------------
E-Mail: d88-skl@nada.kth.se, meLazy@lysator.liu.se, melazy@stacken.kth.se


*****************************************************************************
long
ntol(n)
unsigned long n;
{
    union { unsigned long l; unsigned char b[4];} u;
    unsigned char z;

    u.l=1;
    if (u.b[0]) {
        u.l = n;
        z = u.b[0]; u.b[0] = u.b[3]; u.b[3] = z;
        z = u.b[1]; u.b[1] = u.b[2]; u.b[2] = z;

        return u.l;
    }

    return n;
}

long
lton(n)
unsigned long n;
{
    union { unsigned long l; unsigned char b[4];} u;
    unsigned char z;

    u.l=1;
    if (u.b[0]) {
        u.l = n;
        z = u.b[0]; u.b[0] = u.b[3]; u.b[3] = z;
        z = u.b[1]; u.b[1] = u.b[2]; u.b[2] = z;

        return u.l;
    }

    return n;
}

 

