null-translator.lisp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. (defpackage :null-translator
  2. (:use :cl :hurd-common :mach
  3. :hurd :hurd-translator))
  4. (in-package :null-translator)
  5. (defclass null-translator (translator)
  6. ()
  7. (:documentation "The null-translator."))
  8. (define-callback make-root-node null-translator
  9. (underlying-node underlying-stat)
  10. (declare (ignore underlying-node))
  11. (let ((mode (make-mode :perms '((:owner :read :write)
  12. (:group :read :write)
  13. (:others :read :write))
  14. :type :chr)))
  15. (make-instance 'node
  16. :stat (make-stat underlying-stat
  17. :mode mode))))
  18. (define-callback read-file null-translator
  19. (node user start amount stream)
  20. (declare (ignore translator node user start amount stream))
  21. t)
  22. (define-callback write-file null-translator
  23. (node user offset stream amount)
  24. (declare (ignore translator node user offset amount))
  25. ; Empty the stream to look like we used it all.
  26. (loop while (read-byte stream nil))
  27. t)
  28. (defun main ()
  29. (run-translator (make-instance 'null-translator
  30. :name "null-translator")))
  31. (main)