Path: utzoo!attcan!uunet!husc6!rutgers!bellcore!tness7!killer!ltf
From: ltf@killer.DALLAS.TX.US (Lance Franklin)
Newsgroups: comp.sys.amiga.tech
Subject: Manx scdir function bug under FFS
Summary: Manx's scdir function seems to break under FastFileSystem.
Keywords: Manx,scdir,Examine,ExNext,wildcard,vote none-of-the-above!
Message-ID: <4827@killer.DALLAS.TX.US>
Date: 17 Jul 88 12:37:56 GMT
Reply-To: ltf@killer.UUCP (Lance Franklin)
Organization: The Unix(R) Connection BBS, Dallas, Tx
Lines: 76



Has anybody else noticed a problem with the scdir function under the 
FastFileSystem?  I presently have my system set up with a harddrive
formatted with the FastFileSystem...software I have written (and manx-
supplied functions that use wildcards) no longer works correctly on
the harddrive, although it works fine on the floppys (which, of course,
are still using the old filesystem).

I'm running under 1.3 Gamma Version 34.7, although that doesn't appear
to be the cause of the problem, since scdir seemed to work correctly
when I was running the harddrive under the old filesystem.

B
Luckily, I bought the Commercial Manx-C with the library sources...as
far as I can tell, the problem appears to be due to the fact that
scdir locks, then unlocks the path to the directory each time it's called.
This is, no doubt, to avoid having the directory locked if scdir isn't 
allowed to scan all the files (at which point one would normally UnLock
the directory).  When I modified scdir to lock the directory when first
called, then unlock it when the last file in the directory is found, it
works quite well.

I was just wondering why the FastFileSystem works differently from the old
one.  Just to give the Wizards a better idea of what's happening here,
here's some pseudocode:
/***********************************************************************/
/* scdir current logic flow...(which doesn't work) */

if (first_pass) {
   l = Lock(path); 
   Examine(l,fib);
   if (fib->fib_DirEntryType != DIRECTORY) return(0);
   UnLock(l);
   }
l = Lock(path);
if (ExNext(l,fib)==0) return(0);   /* under FFS, always returns 0 */
UnLock(l);
return(fib->fib_FileName);


/* scdir modified logic flow (which works) */

if (first_pass) {
   l = Lock(path);
   Examine(l,fib);
   if (fib->fib_DirEntryType != DIRECTORY) {
      UnLock(l);
      return(0);
      }
   }
if (ExNext(l,fib)==0) {   /* now works correctly under FFS */
   UnLock(l);
   return(0);
   }
return(fib->fib_FileName);

/***********************************************************************/

Of course, I left out the wildcard comparisons, the error check on locks,
and a few other items, but you get the general idea.

Any Ideas?  What does the FFS do differently from the old filesystem that
would break this code?

Lance

P.S.:  This problem occurs under Manx-C V3.40B...haven't gotten 3.6 yet...
       does the problem still occur?


-- 
+------------------+ +------------------------------------------------------+
| Lance T Franklin | |  Now accepting suggestions for clever, humourous or  |
|    ltf@killer    | |  incredibly insightful .signature quote.  Send Now!  |
+------------------+ +------------------------------------------------------+