forked from fb08af68/cl-fuse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getattr-helpers.lisp
62 lines (54 loc) · 2.23 KB
/
getattr-helpers.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
; Part of cl-fuse FUSE bindings for Common Lisp
; Distributed as free software under Lisp Library General Public License
; Distributed AS IS with NO WARRANTY
(in-package :cl-fuse)
(defcfun "getuid" :int)
(defcfun "getgid" :int)
(defun generic-file (content)
;(fuse-complain "mode was ~s" (foreign-slot-value content '(:struct stat-data) :mode))
;(fuse-complain "inode was ~s" (foreign-slot-value content '(:struct stat-data) :inode))
(setf
(foreign-slot-value content '(:struct stat-data) :on-dev) 0
;(foreign-slot-value content '(:struct stat-data) :inode) 0
(foreign-slot-value content '(:struct stat-data) :mode) #o0555
(foreign-slot-value content '(:struct stat-data) :link-count) 1
(foreign-slot-value content '(:struct stat-data) :uid) (getuid)
(foreign-slot-value content '(:struct stat-data) :gid) (getgid)
(foreign-slot-value content '(:struct stat-data) :device-id) 0
(foreign-slot-value content '(:struct stat-data) :size) 0
(foreign-slot-value content '(:struct stat-data) :blocksize) 0
(foreign-slot-value content '(:struct stat-data) :blockcount) 0
(foreign-slot-value content '(:struct stat-data) :access-time) 0
(foreign-slot-value content '(:struct stat-data) :modification-time) 0
(foreign-slot-value content '(:struct stat-data) :change-time) 0
)
)
(defun writeable-file (content)
(setf
(foreign-slot-value content '(:struct stat-data) :mode)
(boole
boole-ior
#o200
(foreign-slot-value content '(:struct stat-data) :mode)
)))
(defun executable-file (content)
(setf
(foreign-slot-value content '(:struct stat-data) :mode)
(boole
boole-ior
#o100
(foreign-slot-value content '(:struct stat-data) :mode)
)))
(defun generic-directory (content)
(generic-file content)
(setf
(foreign-slot-value content '(:struct stat-data) :mode) (logior mode-directory #o0555)))
(defun generic-symlink (content)
(generic-file content)
(setf
(foreign-slot-value content '(:struct stat-data) :mode) (logior mode-link #o0555)))
(defun generic-plain-file (content size)
(generic-file content)
(setf (foreign-slot-value content '(:struct stat-data) :mode)
(logior mode-regular #o0444))
(setf (foreign-slot-value content '(:struct stat-data) :size) size))