;;; -*- Mode:Lisp; Readtable:ZL; Package:USER; Base:10; Patch-File:T -*-
;;; Patch file for System version 124.20
;;; Reason:
;;;  Changes to File Host access:
;;;    - You can now (send host :set-access flavor) to change the
;;;      file access for that particular host.  If the access method
;;;      is inappropriate, NIL is returned, else the new file access.
;;;    - (fs:reset-file-access) has been extended.  The new calling
;;;      sequence is (fs:reset-file-access &optional hosts flavor)
;;;      Hosts can be a string, symbol, or host object, or a list of
;;;      such items.  If NIL, all hosts are used.  If flavor is
;;;      specified, that access flavor will be used, if appropriate,
;;;      for all the hosts.  If flavor is NIL, the current access
;;;      is reset but no new one is chosen.
;;; Written 2-Jun-88 16:25:19 by pld (Peter L. DeWolf) at site Gigamos Cambridge
;;; while running on Azathoth from band 2
;;; with Experimental System 124.17, Experimental Local-File 74.1, Experimental File-Server 23.1, Experimental Unix-Interface 12.0, Experimental ZMail 72.0, Experimental Tape 23.6, Experimental Lambda-Diag 16.1, microcode 1756, SDU Boot Tape 3.14, SDU ROM 8.



; From modified file DJ: L.IO.FILE; ACCESS.LISP#37 at 2-Jun-88 16:25:33
#10R FILE-SYSTEM#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "FILE-SYSTEM")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: IO; FILE; ACCESS  "


(defmethod (file-host-mixin :set-access) (flavor)
  (setq appropriate-access-flavors (determine-file-access-flavors self))
  (when (member flavor appropriate-access-flavors)
    (when access				;forget old flavor
      (send self :send-if-handles :reset :clear-session))
    (setq access (make-instance flavor :host self))))

))

; From modified file DJ: L.IO.FILE; ACCESS.LISP#37 at 2-Jun-88 16:25:38
#10R FILE-SYSTEM#: 
(COMPILER-LET ((*PACKAGE* (PKG-FIND-PACKAGE "FILE-SYSTEM")))
  (COMPILER::PATCH-SOURCE-FILE "SYS: IO; FILE; ACCESS  "

(defun reset-file-access (&optional hosts flavor)
  (when (variable-boundp *pathname-host-list*)
    (cond ((null hosts)
	   (setq hosts *pathname-host-list*))
	  ((not (consp hosts))
	   (setq hosts (ncons hosts))))
    (dolist (h hosts)
      (when (setq h (fs:get-pathname-host h t nil))
	(if flavor
	    (send h :set-access flavor)
	  (send h :send-if-handles :reset :clear-session))))))

))
