Subject: Re: Mac Aliases changing
From: James Herre (jfh1@pigseye.com)
Date: Fri Jun 27 1997 - 12:21:03 EDT
> I've followed the discussion for some time, and I think
> Helios (Ethershare) has done "the right thing" in this
> case:
>
> First, they have a single database for each volume,
> .Desktop, holding APPL-Signatures, Icons, and the file-
> and directory id database. This db is managed by a single
> process, called desksrv. The afp server processes
> communicate with the desksrv via RPCs. Second, they have
> the id of each file/directory stored in a file named
> ".rsrc/<file/directory name>". This is to reduce RPC
> overhead, as afp servers open this file anyway to get
> the finder information, and to rebuild the desktop
> database if it became corrupted.
>
> I'm working on this approach inside netatalk for 3 moths
> now (in my spare time, which is not that much :-()
I think you're correct that the "right" way to do this is to run
separate server. I'm wondering whether the ".rsrc/<file/directory name>"
files might get messed up if you have overlapping afpd's (eg multiple servers
exporting the same dirs via NFS)?
Anyway, I'm the person who keeps babbling about hash functions. Below is the
function used to assign new DID's into the afpd tree in the version we use.
This returns a DID which is both unique and invariant. It doesn't require any
RPC, IPC, files or file locking. The only problems are that it won't
"always" work (the worst that will happen is that an alias will fail to find
its original) and that it makes aliases work slightly differently than they do
on a regular AppleShare server (if you move the original the alias is stops
working).
Still, if you're lazy like me, you might consider this approach. It will
make your aliases work a very high percentage of the time and, personally, I
prefer aliases that break if you move or rename the original.
-J
--------------------------------------------------------
Jamie Herre
Gettys Group Software, Inc.
jfh1@gettys.com
#ifdef ALIAS_FIX
/* hash function used to generate directory ids (jfh 3/3/96)
I admit that very little thought went into this hash.
*/
static int dirnamehash( vol, directory_path )
struct vol *vol;
char *directory_path;
{
const char *p;
unsigned int result = 0;
for (p=directory_path; *p; p++) {
result = result * 33 + *p;
}
while (result < 5 || dirsearch(vol, htonl(result)) != NULL) {
syslog( LOG_DEBUG, "hash collision: %s", directory_path );
result += 1;
}
return htonl( result );
}
#endif
This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:25:15 EST