link-translator.lisp 865 B

12345678910111213141516171819202122232425262728293031323334
  1. (defpackage :link-translator
  2. (:use :cl :hurd-common :mach
  3. :hurd :hurd-translator))
  4. (in-package :link-translator)
  5. (defconstant +target-link+ (first ext:*args*))
  6. (defclass link-translator (translator)
  7. ()
  8. (:documentation "The link-translator."))
  9. (define-callback make-root-node link-translator
  10. (underlying-node underlying-stat)
  11. (declare (ignore underlying-node))
  12. (let ((obj (make-instance 'node
  13. :stat (make-stat underlying-stat
  14. :type :lnk))))
  15. (setf (link obj) +target-link+)
  16. obj))
  17. (define-callback report-access link-translator
  18. (node user)
  19. (when (has-access-p node user :read)
  20. '(:read)))
  21. (defun main ()
  22. (run-translator (make-instance 'link-translator
  23. :name "link-translator")))
  24. (main)