home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 2 / amigaformatcd02.iso / comms / netsoftware / nethandler.lha / NetHandler / server / lock.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-16  |  2.2 KB  |  65 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  3. /* |. o.| || Reserved.  This program may not be distributed without the    */
  4. /* | .  | || permission of the authors:                            BBS:    */
  5. /* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  6. /* |  . |//                                                                */
  7. /* ======                                                                  */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9.  
  10. /* Lock.c - lock manipulation */
  11. /* RmtLock, RmtDupLock, RmtUnLock */
  12.  
  13. /*-------------------------------------------------------------------------*/
  14. /* Structure of a Lock:                                                    */
  15. /*   struct FileLock {                                                     */
  16. /*      BPTR fl_Link;             Next lock in the chain of device locks   */
  17. /*      LONG fl_Key;              Block number of directory or file header */
  18. /*      LONG fl_Access;           Shared Read (-2) or Exclusive Write (-1) */
  19. /*      struct MsgPort * fl_Task; Handler process for Lock (Us)            */
  20. /*      BPTR fl_Volume;           Node in DevInfo structure for Lock       */
  21. /*      };                                                                 */
  22. /*-------------------------------------------------------------------------*/
  23. #include "server.h"
  24.  
  25. void RmtLock(global, pkt)
  26. GLOBAL global;
  27. struct DosPacket *pkt;
  28. {
  29.    BUG(("RmtLock: lock %lx\n", global->RP.Arg1));
  30.    BUGBSTR("Locking filename = ", global->RP.Data);
  31.  
  32.    pkt->dp_Arg1 = global->RP.Arg1;
  33.    MBSTR(global->RP.Data, global->fib);
  34.    pkt->dp_Arg2 = (LONG)MKBADDR(global->fib);
  35.    pkt->dp_Arg3 = global->RP.Arg3;        /* Mode             */
  36.  
  37.    Dispatch(global);
  38.  
  39.    global->RP.DLen = 0;
  40. }
  41.  
  42. void RmtDupLock(global, pkt)
  43. GLOBAL global;
  44. struct DosPacket *pkt;
  45. {
  46.    BUG(("RmtDupLock\n"));
  47.    pkt->dp_Arg1 = global->RP.Arg1;
  48.  
  49.    Dispatch(global);
  50.  
  51.    global->RP.DLen = 0;
  52. }
  53.  
  54. void RmtUnLock(global, pkt)
  55. GLOBAL global;
  56. struct DosPacket *pkt;
  57. {
  58.    BUG(("RmtUnLock\n"));
  59.    pkt->dp_Arg1 = global->RP.Arg1;
  60.  
  61.    Dispatch(global);
  62.  
  63.    global->RP.DLen = 0;
  64. }
  65.