Commit 67a6a1de666edc2c7d4d159a8167448dde315663

Thomas de Grivel 2015-08-01T01:41:07

Unix stat mode (type + permissions) as a boxed fixnum class.

diff --git a/unix/stat.lisp b/unix/stat.lisp
index 079ab2f..d0f379f 100644
--- a/unix/stat.lisp
+++ b/unix/stat.lisp
@@ -56,6 +56,9 @@
 (defmethod mode-permissions ((mode mode))
   (logand #o007777 (mode-fixnum mode)))
 
+(defmethod mode-permissions (mode)
+  (mode-permissions (mode mode)))
+
 (defmethod mode-string ((mode mode))
   (let* ((num (mode-fixnum mode))
          (type (mode-type num)))
@@ -123,10 +126,19 @@
                      (mode-octal mode)))
          stream))
 
-(mode "dr-xr-x---")
-
 (defun parse-unix-timestamp (x)
   (let ((n (typecase x
 	     (string (parse-integer x))
 	     (integer x))))
     (local-time:unix-to-timestamp n)))
+
+(defmethod describe-probed-property-value (resource property (mode mode))
+  (mode-octal mode))
+
+(defmethod compare-property-values ((resource vnode) (property (eql :mode))
+                                    value1 value2)
+  (= (mode-fixnum value1) (mode-fixnum value2)))
+
+(defmethod match-specified-value ((resource vnode) (property (eql :mode))
+                                  specified probed)
+  (= (mode-fixnum specified) (mode-fixnum probed)))