home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / amiga / programm / 13056 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  2.9 KB

  1. Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!cbfsb!att-out!rutgers!bagate!cbmvax!jesup
  2. From: jesup@cbmvax.commodore.com (Randell Jesup)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Debugging a filesystem handler...
  5. Message-ID: <34877@cbmvax.commodore.com>
  6. Date: 4 Sep 92 00:33:45 GMT
  7. References: <1992Aug31.061928.18053@softway.sw.oz.au>
  8. Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
  9. Organization: Commodore, West Chester, PA
  10. Lines: 61
  11.  
  12. peterc@suite.sw.oz.au (Peter Chubb) writes:
  13. >I'm trying to write a new filesystem handler.  Example code that I've
  14. >looked at (RAW and the disk-handler from earlier Fish disks) debug by
  15. >opening a CON:  window, then sending CMD_WRITE messages to the
  16. >console's message port.  This worked under WB1.3 (last time I tried).
  17. >
  18. >This no longer seems to work under WB2.05.  Instead the console device
  19. >appears to hang -- no new consoles can be opened.  
  20. >I'm using SAS C 5.10a.  The code looks something like:
  21.  
  22. >    debugFH = Open("CON:0/0/640/200/Handler Debug", MODE_NEWFILE);
  23. >
  24. >    fsmsg = taskwait();
  25.  
  26.     2.0 introduced some new internal locking mechanisms to avoid some
  27. old bugs that the system had had since 1.0, such as two copies of the same
  28. filesystem getting started if two things tried to use it at once.
  29.  
  30.     This is handled internally by semaphores.  The side-effect is that
  31. you may NOT do any IO which may require starting another filesystem before
  32. replying your initial packet.  If you do, you will deadlock (as you found
  33. out).
  34.  
  35.     There is one other solution for those that must: mount with a globvec
  36. of -2, and then use Forbid-locking around setting dol_Task.  WARNING: 2.04
  37. mount doesn't handle globvec correctly, it always sets it to 0 or -1.  You'll
  38. have to make it mount some other way, or make something that modifies the
  39. entry Mount creates.  The locking should look like this:
  40.  
  41.     Forbid();
  42.     mustexit = FALSE;
  43.     if (!(dev->dol_Task) || (ks_version < 37))
  44.         dev->dol_Task = FindTask(NULL);
  45.     else
  46.         mustexit = TRUE;
  47.     Permit();
  48.     ...
  49.     ReplyMsg(msg);
  50.  
  51.     ...
  52.     if (mustexit)
  53.         return;
  54.  
  55.  
  56. Note that even if another process beats you to setting dol_Task, you return
  57. success in the packet.  Before V37, dos used your process port for the first
  58. packet instead of taking it from dol_Task, so you _must_ not exit.
  59.  
  60.     Also, under V37 and above, you can use a port other than your process
  61. message port for everything but the startup message, even for a handler
  62. that doesn't set dol_Task.  When you reply the startup packet, set dp_Arg4
  63. to the port to send messages to, and all messages will go there, allowing you
  64. to do normal Dos I/O in your handler.
  65.  
  66. -- 
  67. "Rev on the redline, you're on your own; seems like a lifetime, but soon it's
  68.  gone..."  Foreigner
  69. -
  70. Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
  71. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
  72. Disclaimer: Nothing I say is anything other than my personal opinion.
  73.