[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Restore Distribution

    Date: Mon, 22 Oct 90 15:36 EDT
    From: barmar@think.com (Barry Margolin)
    One thing I realized about the above use of the NULL: host is that the
    logical pathname facility doesn't like more than one logical path to
    translate to the same physical path.  So if you define "SYS:**;*.IBIN.*"
    to translate to "NULL:" then you'll get lots of complaints about
    duplication when you restore the distribution.


If I hadn't defined away the DIRECTORY, NAME, TYPE, and VERSION
components of NULL, this wouldn't be a problem.  So here's a revised,
slightly shorter version, that uses LMFS syntax, but of course,
doesn't CARE what the names of the "files" referenced are, or even
if you supply a name.  So now you can translate SYS:**;*.IBIN to

;;; -*- Mode: LISP; Syntax: Common-Lisp; Base: 10; Package: FILE-SYSTEM; Lowercase: T -*-

(defflavor null-pathname () (lmfs-pathname-mixin pathname))

(defmethod (:fully-merged-p null-pathname) ()

;;; We just use the pathname itself as the access path.  Why not,
;;; it doesn't have to DO anything...

(defmethod (pathname-file-access-path null-pathname) (operation)
  (declare (ignore operation))

(macrolet ((define-methods (name arglist method-body &body methods)
	     (declare (ignore name))
	     (let ((defs ()))
	       (dolist (m methods)
		 (push `(defmethod (,m null-pathname) (,@arglist &rest ignore)
	       `(progn ,@(reverse defs)))))
  (define-methods homedir-methods (&optional (pathname (fs:default-pathname)) care-a-lot-p)
		    (send (send pathname :new-default-pathname :host net:*local-host*)
			  :homedir care-a-lot-p)
   :homedir :quiet-homedir)
  (define-methods null-methods () nil
   :all-directories :delete :directory-list
   :expunge :multiple-file-plists :properties)
  (define-methods error-methods () (error "You can't do that on a null host.")
   :change-properties :rename :undelete))

(defmethod (:complete-string null-pathname) (default-pathname string options)
  (declare (ignore default-pathname options))

;;; This seems to not be used.
(defmethod (:open null-pathname) (pathname &key &allow-other-keys)
  (declare (ignore pathname))

(defmethod (file-access-path-open null-pathname) (&key &allow-other-keys)

(defflavor null-host () (host-null-mixin net:no-device-host-mixin
			 active-pathname-host net:basic-host))

(defflavor host-null-mixin () (net:pathname-host-mixin)
  (:required-flavors net:basic-host))

(defmethod (:pathname-flavor null-host) ()

(defmethod (:name null-host) ()

(defmethod (:system-type null-host) ()

(defvar *null-host* (make-instance 'null-host))

(unless (member *null-host* *pathname-host-list*)
  (push *null-host* *pathname-host-list*))

(unless (assoc *null-host* *default-pathname-defaults*)
  (let ((default (default-pathname)))
    (set-default-pathname *null-pathname*)
    (set-default-pathname default)))