home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff236.lzh / DiskHandler / volume.c < prev   
C/C++ Source or Header  |  1989-08-09  |  3KB  |  104 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
  3. /* |. o.| || This program may not be distributed without the permission of   */
  4. /* | .  | || the authors:                                          BBS:      */
  5. /* | o  | ||   John Toebes     Dave Baker                                    */
  6. /* |  . |//                                                                  */
  7. /* ======                                                                    */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9. /* Volume Manipulation */
  10. /* ActCurentVol  ActRenameDisk ActDiskInfo ActInfo */
  11.  
  12. #include "handler.h"
  13.  
  14. void ActCurentVol(global, pkt)
  15. GLOBAL global;
  16. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  17. {
  18.    BUG(("ActCurentVol\n"));
  19.    pkt->dp_Res1 = MKBADDR(global->volume);
  20. }
  21.  
  22. void ActRenameDisk(global, pkt)
  23. GLOBAL global;
  24. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  25. {
  26.    char *name;
  27.  
  28.    BUG(("ActRenameDisk\n"));
  29.  
  30.    name = (char *)pkt->dp_Arg1;
  31.  
  32.    pkt->dp_Res1 = RenameDisk(global, name);
  33. }
  34.  
  35. void ActDiskInfo(global, pkt)
  36. GLOBAL global;
  37. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  38. {
  39.    struct InfoData *info;
  40.  
  41.    BUG(("ActDiskInfo\n"));
  42.  
  43.    info = (struct InfoData *)pkt->dp_Arg1;
  44.  
  45.    GetVolInfo(global, info);
  46.  
  47.    pkt->dp_Res1 = DOS_TRUE;
  48. }
  49.  
  50. void ActInfo(global, pkt)
  51. GLOBAL global;
  52. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  53. {
  54.    struct FileLock *lock;
  55.    struct InfoData *info;
  56.  
  57.    BUG(("ActInfo\n"));
  58.  
  59.    lock = (struct FileLock *)pkt->dp_Arg1;
  60.    info = (struct InfoData *)pkt->dp_Arg2;
  61.  
  62.    if (lock == NULL ||
  63.        lock->fl_Volume != MKBADDR(global->volume))
  64.       info->id_DiskType = global->diskstatus;
  65.    else
  66.       GetVolInfo(global, info);
  67.  
  68.    pkt->dp_Res1 = DOS_TRUE;
  69. }
  70.  
  71. void GetVolInfo(global, info)
  72. GLOBAL global;
  73. register struct InfoData *info;
  74. {
  75.    register struct DirBlock *block;
  76.  
  77.    if (global->volume == NULL)
  78.       {
  79.       info->id_DiskType = global->diskstatus;
  80.       }
  81.    else
  82.       {
  83.       /* get the block associated with the key */
  84.       block = (struct DirBlock*)GetBlock(global,global->Root);
  85.  
  86.       if (block == NULL)
  87.          info->id_DiskType = global->diskstatus;
  88.  
  89.       else
  90.          {
  91.          /* Now copy over what they wanted */
  92.          info->id_NumSoftErrors = 0;  /* what a lie... */
  93.          info->id_UnitNumber    = global->unitnum;
  94.          info->id_DiskState = global->diskstate;
  95.          info->id_NumBlocks = ((global->dskenv.de_numblks)-
  96.                                (global->dskenv.de_reservedblks));
  97.          info->id_NumBlocksUsed = CountBlocks(global);
  98.          info->id_DiskType = global->volume->dl_DiskType;
  99.          info->id_VolumeNode = MKBADDR(global->volume);
  100.          info->id_InUse = 0;
  101.          }
  102.       }
  103. }
  104.