Table of Contents

DMSERS Abstract

Statistics

Type ASSEMBLE
Source Lines : 926
Fixes Applied : 3
Most Recent Version : Tuesday, December 12, 1978
Last Fix ID : [HRC015DS]

Synopsis

Module

       DMSERS (ERASE)

Function

       TO  DELETE A  FILE  OR RELATED  GROUP  OF FILES  FROM
       READ-WRITE DISK(S).

Attributes

     NUCLEUS RESIDENT

Operation

       DMSERS CHECKS  THE PARAMETER LIST  FOR ERRORS  BY THE
       CALLER.  THE FILENAME
       AND FILETYPE MUST  EACH BE GIVEN, OR  ELSE A ASTERISK
       IN  PLACE OF  FILENAME OR  FILETYPE  TO INDICATE  ALL
       NAMES AND/OR ALL TYPES.  THE  FILEMODE MAY BE OMITTED
       IN WHICH CASE  THE FIRST READ-WRITE DISK  IS ASSUMED.
       IF NOT OMITTED, THE FILEMODE  MUST BE ALPHABETIC.  IF
       ALPHABETIC, A MODE NUMBER IS ACCEPTABLE.

       FOR EXAMPLE,  A CALL OF ERASE  * TEXT A5  WOULD ERASE
       ALL TEXT FILES  ON THE A-DISK THAT HAD  A MODE NUMBER
       OF 5.  ALL OTHER TEXT FILES ON ANY DISKS WOULD REMAIN
       INTACT, AND ALL OTHER A5 FILES WOULD REMAIN ALSO.

       IF ANY  ERRORS ARE  DETECTED IN  THE PARAMETER  LIST,
       ERROR 1 IS RETURNED, AND NOTHING IS ERASED.

       AFTER  CHECKING   THE  PARAMETER  LIST   AND  SETTING
       FLAGBITS AS NEEDED, DMSERS CHECKS FOR A
       GIVEN  FILE  AND  DELETES  IT,  IF  FOUND, USING  THE
       FOLLOWING PROCEDURE:

     1.   DMSLAF  IS CALLED  TO DETERMINE  IF    THE   FILE
          TO BE  ERASED IS  STILL ACTIVE -  THAT IS,  IN THE
          ACTIVE FILE TABLE (AFT).  IF IT IS (ONLY A FILE ON
          A READ-WRITE DISK IS  ACCEPTABLE, OF COURSE), THEN
          IT IS TEMPORARILY CLOSED VIA A CALL TO EFINIS IN
          THE DMSFNT ROUTINE, WHICH  PERFORMS JUST ENOUGH OF
          THE NORMAL  CLOSING STEPS ORDINARILY  PERFORMED BY
          DMSFNS  TO  PERMIT  THE FILE  TO  BE  SUCCESSFULLY
          ERASED. PROCEEDS
          THEN TO STEP 3 BELOW.

     2.   IF NOT FOUND  BY DMSLAF, THEN DMSERS  CALLS DMSLFS
          TO FIND THE FILE.  IF NOT FOUND, EXIT IS MADE FROM
          DMSERS AS DESCRIBED IN STEP 14 BELOW.

     3.   WHEN THE FILE HAS BEEN FOUND EITHER BY DMSLAF (AND
          DMSFNSE CALLED),  OR BY  DMSLFSW, THEN  DMSFNST IS
          CALLED TO  TEMPORARILY CLOSE ALL OUTPUT  FILES FOR
          THIS
          PARTICULAR   DISK   (UNLESS   THIS   WAS   ALREADY
          ACCOMPLISHED BY AN EARLIER  EXCURSION THROUGH THIS
          PROCEDURE FOR ANOTHER FILE ON THE SAME DISK).

     4.   DMSERS THEN  CHECKS THE  TYPE OPTION  FLAG BIT  TO
          DETERMINE IF THE USER SPECIFIED
          THAT THE IDENTIFIER(S) OF THE FILE(S) BEING ERASED
          ARE TO BE TYPED TO THE CONSOLE.
          IF THE BIT IS ON, THE PLIST  IS SET UP, AND A CALL
          IS MADE TO DMSCWR.

     5.   BEFORE RELEASING ANY TRACKS  BELONGING TO THE FILE
          THAT HAS BEEN FOUND, DMSERS  CALLS A SPECIAL ENTRY
          IN THE  DMSAUD ROUTINE  TO RESERVE ENOUGH   DISK
          RECORDS FOR  A NEW  FILE DIRECTORY  TO BE  UPDATED
          WHEN THE FILE HAS BEEN  ERASED.  THIS PROCEDURE IS
          PART OF CMS'S DOUBLE DIRECTORY SCHEME, AND ENSURES
          THAT THE  FILE DIRECTORY FOR  THE DISK  FROM WHICH
          THE FILE IS BEING ERASED  IS UPDATED WHEN AND ONLY
          WHEN THE ERASE HAS BEEN  COMPLETED. (IF ANY SYSTEM
          MALFUNCTION  OR USER  INTERVENTION INTERRUPTS  THE
          PROCESS BEFORE COMPLETION, THE  OLD FILE DIRECTORY
          AND THE FILE BEING ERASED ARE BOTH STILL INTACT.)

     6.   THEN (UNLESS IT IS  ALREADY AVAILABLE), 1000 BYTES
          OF FREE STORAGE ARE OBTAINED VIA
          DMSFREE, FOR USE IN READING IN THE FIRST AND OTHER
          (IF ANY) CHAIN LINKS OF THE FILE.

     7.   NEXT THE FIRST CHAIN LINK OF THE FILE IS READ INTO
          CORE, INTO THE FIRST 200 BYTES OF
          FREE STORAGE AREA, VIA DMSDIOR.

     8.   THE DATA BLOCKS POINTED TO BY THE FIRST CHAIN LINK
          ARE THEN RELEASED VIA DMSTRKX, AND THE FIRST CHAIN
          LINK  ITSELF VIA  DMSTQQX  (THE  FIRST CHAIN  LINK
          REMAINING IN CORE, HOWEVER).

     9.   IF ANY DATA BLOCKS REMAIN, ACCORDING TO THE FSTDBC
          DATA-BLOCK-COUNT IN THE FST ENTRY, THEN ADDITIONAL
          CHAIN LINKS ARE  READ INTO CORE, AS  POINTED TO BY
          THE FIRST CHAIN LINK.  FOR EACH OF THESE NTH CHAIN
          LINKS, THE DATA BLOCKS POINTED TO THEREBY ARE
          RELEASED  VIA DMSTRKX,  AND  THEN  THE CHAIN  LINK
          ITSELF.  THIS PROCESS CONTINUES, WITH
          A COUNT OF DATA BLOCKS RETURNED BEING DECREMENTED,
          UNTIL THERE ARE NONE LEFT,  OR ALL AVAILABLE CHAIN
          LINKS HAVE BEEN EXHAUSTED.

     10.  AT THIS  POINT, ALL  DATA BLOCKS  AND CHAIN  LINKS
          HAVE BEEN GIVEN BACK TO THE QMSK AND
          QQMSK VIA APPROPRIATE CALLS TO DMSTRKX AND THE ONE
          CALL TO DMSTQQX.  NOW A CHECK IS MADE
          TO SEE IF PERCHANCE THE FILE BEING ERASED  HAPPENS
          TO BE CONTAINED IN STATEFST.  IF SO,
          THE CONTENTS  OF STATEFST  ARE CLEARED  TO REFLECT HRC015DS
          THE DELETION OF THE GIVEN FILE.  (NOTE - DMSBRD
          UTILIZES   THE   STATEFST  INFORMATION   IN   SOME
          CIRCUMSTANCES; THUS  IT MUST BE EITHER  CORRECT OR
          NULL.)

     11.  NEXT  PROVISIONS   ARE  MADE   TO  KEEP   THE  FST
          HYPERBLOCKS COMPACTED,  FOR THE DISK ON  WHICH THE
          FILE WAS FOUND  AND ERASED.  IN THIS  PROCESS, THE
          LAST FST ENTRY  FOR THE DISK INVOLVED  IS MOVED TO
          WHERE THE FST ENTRY WAS FOR  THE FILE THAT WE JUST
          ERASED, AND THE
          PLACE FROM WHICH IT WAS MOVED IS CLEARED.  A CHECK
          IS MADE OF THE ACTIVE FILE TABLE VIA DMSLAFNX
          IN CASE  AN ACTIVE FILE  ENTRY POINTS TO  THE FILE
          MOVED, IN WHICH CASE THE POINTER IS CORRECTED; THE
          POINTER FOLLOWING  STATEFST IS  ALSO CHECKED,  AND
          CORRECTED  IF   NECESSARY.   IN  ANY   EVENT,  THE
          COMPACTING  IS  CAREFULLY ACCOMPLISHED,  WITH  ALL
          POINTERS, DISPLACEMENTS, BLOCK COUNTS, ETC., BEING
          CORRECTED AS NECESSARY.

     12.  FINALLY,  A CALL  TO THE  OTHER  ENTRY  OF DMSAUD
          IS  MADE TO COMPLETE THE  UPDATING OF
          THE FILE DIRECTORY FOR THE DISK INVOLVED.

     13.  AT THIS  POINT, IF THE  ENTIRE FST  HYPERBLOCK AND
          THE  LAST FST  ENTRY IN  THE PRECEDING  HYPERBLOCK
          HAVE  ALL BECOME  CLEAR,  THE  LAST HYPERBLOCK  IS
          RETURNED  TO FREE  STORAGE, AND  ALL POINTERS  AND
          COUNTS CORRECTED  ACCORDINGLY.  (THIS  IS DONE  TO
          AVOID  KEEPING A  NUMBER OF  EMPTY HYPERBLOCKS  IN
          CORE IN CASE A LARGE NUMBER OF FILES ARE ERASED.)

     14.  FINALLY, THE ENTIRE PROCEDURE IS REPEATED STARTING
          AT STEP  1, IF  THE PARAMETER  LIST SPECIFIED  ALL
          NAMES, TYPES, OR MODES.

     15.  WHEN  ALL APPROPRIATE  ERASING (IF  ANY) HAS  BEEN
          COMPLETED, DMSERS RETURNS THE 1000-BYTE
          BUFFER TO FREE  STORAGE, AND EXISTS TO  THE CALLER
          WITH THE APPROPRIATE ERROR CODE.

       IF NO  FILES AT  ALL WERE  ERASED, DMSERS  RETURNS AN
       ERROR CODE 2, BUT WITHOUT  AN ERROR MESSAGE. (SEVERAL
       SYSTEM  PROGRAMS   CALL  DMSERS   TO  ELIMINATE   OLD
       LISTINGS, OLD  TEXT FILES, ETC.,  IN CASE  THEY MIGHT
       EXIST, SO THAT AN ERROR MESSAGE FOR FILE NOT FOUND IN
       DMSERS ITSELF WOULD BE IMPRACTICAL.)

       SEVERAL ERROR CONDITIONS ARE  DETECTED BY DMSERS.  ON
       ONE OF THESE,  A PERMANENT I/O ERROR IN  READING IN A
       CHAIN  LINK  DUE  TO  HARDWARE  DISK  ERRORS,  DMSERS
       PURPOSELY INVOKES
       THE CODE  AT DMSFNSD  (WITHIN THE  FINIS COMMAND)  TO
       LEAVE THE FILE DIRECTORY INTACT UNTIL
       THE DISK ERROR CAN BE CORRECTED.

       ON ALL  OTHERS, WHEN  THE ERROR  IS DETECTED,  DMSERS
       CEASES TO GIVE BACK RECORDS USING
       DMSTKX  AND/OR DMSTQQX,  BUT  DELETES  THE FILES  AND
       COMPACTS THE DIRECTORY AS USUAL.  AN ERROR 3 IS GIVEN
       ON EXIT, WHEN DMSERS IS FINISHED.

       THIS FEATURE MAKES IT FEASIBLE TO ERASE A FAULTY FILE
       FROM   ONE'S   DIRECTORY  WITHOUT   ENDANGERING   THE
       INTEGRITY OF OTHER FILES ON THE SAME DISK.

Calls to Other Routines

       DMSLAD - LOCATE THE FIRST R/W DISK
       DMSLAF - FIND THE ACTIVE FILE TABLE FOR THE GIVEN FILE
       DMSLAFFE -FIND THE NEXT ACTIVE FILE TABLE
       DMSFNSD - 'DIE' IF PERMANENT ERROR READING DISK
       DMSFNST - TEMPORARILY CLOSE A FILE
       DMSFREE - GET FREE STORAGE
       DMSFRET - RETURN FREE STORAGE
       DMSLFS - FIND THE SPECIFIED FILE STATUS TABLE
       DMSTQQ - ALLOCATE A 200 BYTE DISK AREA
       DMSDIOR -
       DMSTRKW -
       DMSAUD - CLOSE ALL FILES AND UPDATE THE USER FILE DIRECTORY
       DMSCWRB - TYPE A LINE TO THE TERMINAL
       DMSTQQX -