ffi-libfuse 0.0.1.rctest12 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CHANGELOG.md +60 -0
- data/LICENSE +21 -0
- data/README.md +127 -44
- data/lib/ffi/accessors.rb +6 -6
- data/lib/ffi/boolean_int.rb +27 -0
- data/lib/ffi/devt.rb +23 -0
- data/lib/ffi/encoding.rb +38 -0
- data/lib/ffi/flock.rb +7 -5
- data/lib/ffi/gnu_extensions.rb +1 -1
- data/lib/ffi/libfuse/ackbar.rb +3 -3
- data/lib/ffi/libfuse/adapter/context.rb +12 -10
- data/lib/ffi/libfuse/adapter/fuse2_compat.rb +52 -51
- data/lib/ffi/libfuse/adapter/fuse3_support.rb +7 -4
- data/lib/ffi/libfuse/adapter/interrupt.rb +1 -1
- data/lib/ffi/libfuse/adapter/ruby.rb +499 -148
- data/lib/ffi/libfuse/adapter/safe.rb +12 -11
- data/lib/ffi/libfuse/adapter.rb +1 -2
- data/lib/ffi/libfuse/callbacks.rb +1 -1
- data/lib/ffi/libfuse/filesystem/accounting.rb +116 -0
- data/lib/ffi/libfuse/filesystem/mapped_dir.rb +74 -0
- data/lib/ffi/libfuse/filesystem/mapped_files.rb +141 -0
- data/lib/ffi/libfuse/filesystem/pass_through_dir.rb +55 -0
- data/lib/ffi/libfuse/filesystem/pass_through_file.rb +45 -0
- data/lib/ffi/libfuse/filesystem/utils.rb +102 -0
- data/lib/ffi/libfuse/filesystem/virtual_dir.rb +306 -0
- data/lib/ffi/libfuse/filesystem/virtual_file.rb +94 -0
- data/lib/ffi/libfuse/filesystem/virtual_fs.rb +196 -0
- data/lib/ffi/libfuse/filesystem/virtual_node.rb +101 -0
- data/lib/ffi/libfuse/filesystem.rb +25 -0
- data/lib/ffi/libfuse/fuse2.rb +32 -24
- data/lib/ffi/libfuse/fuse3.rb +28 -18
- data/lib/ffi/libfuse/fuse_args.rb +71 -34
- data/lib/ffi/libfuse/fuse_buffer.rb +128 -26
- data/lib/ffi/libfuse/fuse_callbacks.rb +1 -5
- data/lib/ffi/libfuse/fuse_common.rb +60 -61
- data/lib/ffi/libfuse/fuse_config.rb +134 -143
- data/lib/ffi/libfuse/fuse_conn_info.rb +310 -134
- data/lib/ffi/libfuse/fuse_context.rb +45 -3
- data/lib/ffi/libfuse/fuse_operations.rb +57 -21
- data/lib/ffi/libfuse/fuse_opt.rb +1 -1
- data/lib/ffi/libfuse/fuse_version.rb +10 -6
- data/lib/ffi/libfuse/gem_version.rb +54 -0
- data/lib/ffi/libfuse/main.rb +96 -48
- data/lib/ffi/libfuse/test_helper.rb +145 -0
- data/lib/ffi/libfuse/version.rb +1 -1
- data/lib/ffi/libfuse.rb +13 -4
- data/lib/ffi/ruby_object.rb +4 -1
- data/lib/ffi/stat/constants.rb +9 -0
- data/lib/ffi/stat/native.rb +36 -6
- data/lib/ffi/stat/time_spec.rb +26 -10
- data/lib/ffi/stat.rb +111 -22
- data/lib/ffi/stat_vfs.rb +59 -1
- data/lib/ffi/struct_wrapper.rb +22 -1
- data/sample/hello_fs.rb +54 -0
- data/sample/memory_fs.rb +5 -181
- data/sample/no_fs.rb +20 -21
- data/sample/pass_through_fs.rb +30 -0
- metadata +83 -10
- data/lib/ffi/libfuse/adapter/thread_local_context.rb +0 -36
- data/lib/ffi/libfuse/test/operations.rb +0 -56
- data/lib/ffi/libfuse/test.rb +0 -3
@@ -5,77 +5,78 @@ module FFI
|
|
5
5
|
module Adapter
|
6
6
|
# Wrapper module to assist filesystem written for Fuse3 to be compatible with Fuse2
|
7
7
|
module Fuse2Compat
|
8
|
-
# @!visibility private
|
9
8
|
# Wrapper shim for fuse methods to ensure compatibility with Fuse2
|
10
|
-
module
|
9
|
+
module Prepend
|
11
10
|
include Adapter
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
super(path, size, fuse_file_info)
|
19
|
-
end
|
12
|
+
if FUSE_MAJOR_VERSION == 2
|
13
|
+
# @!visibility private
|
14
|
+
def getattr(path, stat, fuse_file_info = nil)
|
15
|
+
super(path, stat, fuse_file_info)
|
16
|
+
end
|
20
17
|
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
def truncate(path, size, fuse_file_info = nil)
|
19
|
+
super(path, size, fuse_file_info)
|
20
|
+
end
|
24
21
|
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
def init(fuse_conn_info, fuse_config = nil)
|
23
|
+
super(fuse_conn_info, fuse_config)
|
24
|
+
end
|
28
25
|
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
def chown(path, uid, gid, fuse_file_info = nil)
|
27
|
+
super(path, uid, gid, fuse_file_info)
|
28
|
+
end
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
def chmod(path, mode, fuse_file_info = nil)
|
31
|
+
super(path, mode, fuse_file_info)
|
32
|
+
end
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
34
|
+
def utimens(path, atime, mtime, fuse_file_info = nil)
|
35
|
+
super(path, atime, mtime, fuse_file_info)
|
36
|
+
end
|
41
37
|
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
def readdir(path, buffer, filler, offset, fuse_file_info, fuse_readdir_flag = 0)
|
39
|
+
f3_fill = proc { |buf, name, stat, off = 0, _fuse_fill_dir_flag = 0| filler.call(buf, name, stat, off) }
|
40
|
+
super(path, buffer, f3_fill, offset, fuse_file_info, fuse_readdir_flag)
|
41
|
+
end
|
45
42
|
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
def fgetattr(path, stat, ffi)
|
44
|
+
stat.clear # For some reason (at least on OSX) the stat is not clear when this is called.
|
45
|
+
getattr(path, stat, ffi)
|
46
|
+
0
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
49
|
+
def ftruncate(*args)
|
50
|
+
truncate(*args)
|
51
|
+
end
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
fuse_config = FuseConfig.new
|
59
|
-
init_fuse_config(fuse_config, :fuse2)
|
60
|
-
res << :nullpath_ok if fuse_config.nullpath_ok?
|
53
|
+
def fuse_respond_to?(fuse_method)
|
54
|
+
fuse_method = fuse_method[1..].to_sym if %i[fgetattr ftruncate].include?(fuse_method)
|
55
|
+
super(fuse_method)
|
61
56
|
end
|
62
57
|
|
63
|
-
|
64
|
-
|
65
|
-
|
58
|
+
def fuse_flags
|
59
|
+
res = defined?(super) ? super : []
|
60
|
+
if respond_to?(:init_fuse_config)
|
61
|
+
fuse_config = FuseConfig.new
|
62
|
+
init_fuse_config(fuse_config, :fuse2)
|
63
|
+
res << :nullpath_ok if fuse_config.nullpath_ok?
|
64
|
+
end
|
66
65
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
66
|
+
res
|
67
|
+
end
|
68
|
+
|
69
|
+
else
|
70
|
+
def init(*args)
|
71
|
+
init_fuse_config(args.detect { |a| a.is_a?(FuseConfig) }) if respond_to?(:init_fuse_config)
|
72
|
+
super if defined?(super)
|
73
|
+
end
|
72
74
|
end
|
73
75
|
end
|
74
76
|
|
75
77
|
# @!visibility private
|
76
78
|
def self.included(mod)
|
77
|
-
|
78
|
-
mod.prepend(prepend_module)
|
79
|
+
mod.prepend(Prepend)
|
79
80
|
end
|
80
81
|
|
81
82
|
# @!method init_fuse_config(fuse_config,compat)
|
@@ -12,7 +12,6 @@ module FFI
|
|
12
12
|
#
|
13
13
|
module Fuse3Support
|
14
14
|
# The actual module methods that are prepended
|
15
|
-
# @!visibility private
|
16
15
|
module Prepend
|
17
16
|
include Adapter
|
18
17
|
|
@@ -23,14 +22,14 @@ module FFI
|
|
23
22
|
|
24
23
|
def getattr(*args)
|
25
24
|
fi = args.pop
|
26
|
-
return fgetattr(*args, fi) if fi &&
|
25
|
+
return fgetattr(*args, fi) if fi && fuse_super_respond_to?(:fgetattr)
|
27
26
|
|
28
27
|
super(*args)
|
29
28
|
end
|
30
29
|
|
31
30
|
def truncate(*args)
|
32
31
|
fi = args.pop
|
33
|
-
return ftruncate(*args, fi) if fi &&
|
32
|
+
return ftruncate(*args, fi) if fi && fuse_super_respond_to?(:ftruncate)
|
34
33
|
|
35
34
|
super(*args)
|
36
35
|
end
|
@@ -51,7 +50,7 @@ module FFI
|
|
51
50
|
# but there is no way to handle OMIT
|
52
51
|
def utimens(*args)
|
53
52
|
args.pop
|
54
|
-
super(*args)
|
53
|
+
super(*args) if defined?(super)
|
55
54
|
end
|
56
55
|
|
57
56
|
def init(*args)
|
@@ -74,6 +73,10 @@ module FFI
|
|
74
73
|
|
75
74
|
super(*args, &block)
|
76
75
|
end
|
76
|
+
|
77
|
+
def fuse_respond_to(fuse_callback)
|
78
|
+
super || (%i[truncate getattr].include?(fuse_callback) && fuse_super_respond_to?("f#{fuse_callback}"))
|
79
|
+
end
|
77
80
|
end
|
78
81
|
|
79
82
|
# @!visibility private
|