(FILECREATED "20-Jun-84 15:35:37" {ERIS}<LISPNEW>SOURCES>EVENTPATCH.;5 2707   

      changes to:  (VARS EVENTPATCHCOMS)
		   (FNS \DFSEventFn)

      previous date: "19-Jun-84 20:58:58" {ERIS}<LISPNEW>SOURCES>EVENTPATCH.;4)


(* Copyright (c) 1984 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT EVENTPATCHCOMS)

(RPAQQ EVENTPATCHCOMS [(* * change to eventfn to make multiple lisp images work right, return from 
			  sysout work right, etc.)
		       (FNS \DFSEventFn)
		       (* * This will cause \DFSReadVolumes to be set to NIL before exiting lisp)
		       (P (pushnew \SYSTEMCACHEVARS (QUOTE \DFSReadVolumes])
(* * change to eventfn to make multiple lisp images work right, return from sysout work right, 
etc.)

(DEFINEQ

(\DFSEventFn
  [LAMBDA (Dev Event)                                        (* hts: "20-Jun-84 15:30")
    (UNINTERRUPTABLY
        (SELECTQ Event
		 [(AFTERLOGOUT AFTERSYSOUT AFTERMAKESYS AFTERSAVEVM)
		   (FORGETPAGES (fetch DirectoryStream of Dev))
		   (\DFSVFMInit)
		   (\DFSVAMInit)
		   (PROG (LvNum)

          (* * if same machine & partitions, just reopen the directory file; else remove the device.)


		         (if [AND (EQ (MACHINETYPE)
				      (QUOTE DANDELION))
				  (EQUAL \DFSMachineId \MY.NSHOSTNUMBER)
				  [SETQ LvNum (PROGN (OR \DFSReadVolumes (\DFSGetVolumeInfo))
						     (\DFSGetLvNum (MKSTRING (fetch (FDEV DEVICENAME)
										of Dev]
				  (EQ DFSLispVolume (fetch (LogicalVolumeDescriptor type)
						       of (LvPagePtr LvNum]
			     then (replace (DLIONDISK DirectoryStream) of Dev with (\DFSOpenDirectory
										     Dev))
			   else (replace (FDEV REOPENFILE) of Dev with (FUNCTION NILL)) 
                                                             (* ensure that no local files from another machine 
							     (or the same machine with changed logical volumes) will 
							     be reopened)
				(\REMOVEDEVICE Dev)
				(printout NIL "Device {" (fetch (FDEV DEVICENAME) of Dev)
					  "} has disappeared." T)
				(SETQ \DFSInitialized NIL) 
                                                             (* Make the 1108 file system reinitialize itself)
				(if (NEQ (MACHINETYPE)
					 (QUOTE DANDELION))
				    then (\OPENDISKDEVICE 0) 
                                                             (* Open mod44 disk)]
		 (BEFORELOGOUT (\FLUSH.OPEN.STREAMS Dev))
		 NIL))])
)
(* * This will cause \DFSReadVolumes to be set to NIL before exiting lisp)

(pushnew \SYSTEMCACHEVARS (QUOTE \DFSReadVolumes))
(PUTPROPS EVENTPATCH COPYRIGHT ("Xerox Corporation" 1984))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (747 2494 (\DFSEventFn 757 . 2492)))))
STOP