rfuse 1.1.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/CHANGES.md +6 -0
- data/README.md +3 -2
- data/ext/rfuse/rfuse.c +2 -2
- data/lib/rfuse/version.rb +1 -1
- metadata +25 -42
- data/.gitignore +0 -5
- data/.travis.yml +0 -20
- data/Gemfile +0 -4
- data/Rakefile +0 -17
- data/ext/.gitignore +0 -2
- data/rfuse.gemspec +0 -31
- data/sample/test-ruby.rb +0 -310
- data/spec/basic_spec.rb +0 -243
- data/spec/fuse_file_info_spec.rb +0 -119
- data/spec/main_spec.rb +0 -161
- data/spec/options_spec.rb +0 -143
- data/spec/ruby_loop_spec.rb +0 -63
- data/spec/run_spec.rb +0 -60
- data/spec/signals_spec.rb +0 -108
- data/spec/spec_helper.rb +0 -109
- data/spec/xattr_spec.rb +0 -49
checksums.yaml
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
|
|
5
|
-
data.tar.gz: !binary |-
|
|
6
|
-
NjM5NmMwZGI1MTAyODRiYTlmYzQ2NzI3NmM2YTdkMmI0Mzk0NzFmOQ==
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: f9bbd56ab8bb580e8c2a40b19b15a75bf7afad004296c72d3e8157e0a6fbb223
|
|
4
|
+
data.tar.gz: 1eeef7cb6a0f6a874da3b87d99452af3737cfa7d973650ccb5eaed992174a48f
|
|
7
5
|
SHA512:
|
|
8
|
-
metadata.gz:
|
|
9
|
-
|
|
10
|
-
OGJlN2ViZmRjNTZhODYxYjMyYWJjMGYwNjc1NTAxY2QzYjgyZTljNzZmYjhk
|
|
11
|
-
OGQ3NmM1NjU1YjJjNGFiZjYyNTk2Mzk2OTNjNzFjMjk2NWFjMWY=
|
|
12
|
-
data.tar.gz: !binary |-
|
|
13
|
-
NThhNWNiYzNlYTQ5MTU3ZWM5OWIxMTdmZGU4NWI3N2M1ODNiYzVhNGU3Zjkx
|
|
14
|
-
M2FiMGYwNmQ4MmM5NzQ4NDE0MDg3NzFmNzY4MmUzZTFkMzE1MGNjOGMxZjRk
|
|
15
|
-
MmZkNmZmZTI5NjkyMTU1ZDIzNTZhZjU4NDVmNzQ2ZDAyZWY2NDk=
|
|
6
|
+
metadata.gz: 124adc8292a4f1a017e3034d51d645486629992f97ff8b106366929a752b36bf3f25e228001cb8af21a5f7a98147c430bbf2de226d31f7e4392c4bba83151b86
|
|
7
|
+
data.tar.gz: 11b76dd86a7b1687ef877c6d660a71c041d728341bb5e3200da5a97f6ba80a64102fd2134338f9c7edca67106688ba0a9109fc76024c2fb800254b33f7994d3d
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
|
@@ -2,6 +2,7 @@ RFuse
|
|
|
2
2
|
===============
|
|
3
3
|
|
|
4
4
|
http://rubygems.org/gems/rfuse
|
|
5
|
+

|
|
5
6
|
|
|
6
7
|
Ruby FUSE binding
|
|
7
8
|
|
|
@@ -14,8 +15,8 @@ For a more ruby-ish API for creating filesystems see {http://rubygems.org/gems/r
|
|
|
14
15
|
Dependencies
|
|
15
16
|
--------------
|
|
16
17
|
|
|
17
|
-
* Ruby
|
|
18
|
-
* Fuse 2.8
|
|
18
|
+
* Ruby 2.5+
|
|
19
|
+
* Fuse 2.8+
|
|
19
20
|
|
|
20
21
|
Installation
|
|
21
22
|
---------------
|
data/ext/rfuse/rfuse.c
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
#define _XOPEN_SOURCE 500
|
|
4
4
|
#endif
|
|
5
5
|
//FOR LINUX ONLY
|
|
6
|
-
|
|
6
|
+
//#include <linux/stat.h>
|
|
7
7
|
#include <linux/kdev_t.h>
|
|
8
8
|
|
|
9
9
|
#include <ruby.h>
|
|
@@ -1190,7 +1190,7 @@ static int rf_releasedir(const char *path,struct fuse_file_info *ffi)
|
|
|
1190
1190
|
*/
|
|
1191
1191
|
static VALUE unsafe_fsyncdir(VALUE *args)
|
|
1192
1192
|
{
|
|
1193
|
-
return
|
|
1193
|
+
return rb_funcall2(args[0],rb_intern("fsyncdir"),4,&args[1]);
|
|
1194
1194
|
}
|
|
1195
1195
|
|
|
1196
1196
|
static int rf_fsyncdir(const char *path,int meta,struct fuse_file_info *ffi)
|
data/lib/rfuse/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,111 +1,111 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rfuse
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Grant Gardner
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- -
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '0'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- -
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: rake-compiler
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
30
30
|
requirements:
|
|
31
|
-
- -
|
|
31
|
+
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
33
|
version: '0'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
|
-
- -
|
|
38
|
+
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
40
|
version: '0'
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: rspec
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
|
-
- -
|
|
45
|
+
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: '0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
|
-
- -
|
|
52
|
+
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version:
|
|
54
|
+
version: '0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: yard
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
|
-
- -
|
|
59
|
+
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
61
|
version: '0'
|
|
62
62
|
type: :development
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
|
-
- -
|
|
66
|
+
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
68
|
version: '0'
|
|
69
69
|
- !ruby/object:Gem::Dependency
|
|
70
70
|
name: redcarpet
|
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
|
72
72
|
requirements:
|
|
73
|
-
- -
|
|
73
|
+
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
75
|
version: '0'
|
|
76
76
|
type: :development
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
|
-
- -
|
|
80
|
+
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: ffi-xattr
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
|
-
- -
|
|
87
|
+
- - ">="
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
89
|
version: '0'
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
|
-
- -
|
|
94
|
+
- - ">="
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: sys-filesystem
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- -
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
103
|
version: '0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- -
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
description: Write userspace filesystems in Ruby
|
|
@@ -117,15 +117,10 @@ extensions:
|
|
|
117
117
|
extra_rdoc_files:
|
|
118
118
|
- CHANGES.md
|
|
119
119
|
files:
|
|
120
|
-
- .
|
|
121
|
-
- .travis.yml
|
|
122
|
-
- .yardopts
|
|
120
|
+
- ".yardopts"
|
|
123
121
|
- CHANGES.md
|
|
124
|
-
- Gemfile
|
|
125
122
|
- LICENSE
|
|
126
123
|
- README.md
|
|
127
|
-
- Rakefile
|
|
128
|
-
- ext/.gitignore
|
|
129
124
|
- ext/rfuse/bufferwrapper.c
|
|
130
125
|
- ext/rfuse/bufferwrapper.h
|
|
131
126
|
- ext/rfuse/context.c
|
|
@@ -150,19 +145,9 @@ files:
|
|
|
150
145
|
- lib/rfuse/compat.rb
|
|
151
146
|
- lib/rfuse/version.rb
|
|
152
147
|
- lib/rfuse_ng.rb
|
|
153
|
-
- rfuse.gemspec
|
|
154
|
-
- sample/test-ruby.rb
|
|
155
|
-
- spec/basic_spec.rb
|
|
156
|
-
- spec/fuse_file_info_spec.rb
|
|
157
|
-
- spec/main_spec.rb
|
|
158
|
-
- spec/options_spec.rb
|
|
159
|
-
- spec/ruby_loop_spec.rb
|
|
160
|
-
- spec/run_spec.rb
|
|
161
|
-
- spec/signals_spec.rb
|
|
162
|
-
- spec/spec_helper.rb
|
|
163
|
-
- spec/xattr_spec.rb
|
|
164
148
|
homepage: http://rubygems.org/gems/rfuse
|
|
165
|
-
licenses:
|
|
149
|
+
licenses:
|
|
150
|
+
- GPL-2.0
|
|
166
151
|
metadata: {}
|
|
167
152
|
post_install_message:
|
|
168
153
|
rdoc_options: []
|
|
@@ -170,19 +155,17 @@ require_paths:
|
|
|
170
155
|
- lib
|
|
171
156
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
172
157
|
requirements:
|
|
173
|
-
- -
|
|
158
|
+
- - ">="
|
|
174
159
|
- !ruby/object:Gem::Version
|
|
175
|
-
version: '
|
|
160
|
+
version: '2.5'
|
|
176
161
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
162
|
requirements:
|
|
178
|
-
- -
|
|
163
|
+
- - ">="
|
|
179
164
|
- !ruby/object:Gem::Version
|
|
180
165
|
version: '0'
|
|
181
166
|
requirements: []
|
|
182
|
-
|
|
183
|
-
rubygems_version: 2.1.11
|
|
167
|
+
rubygems_version: 3.0.8
|
|
184
168
|
signing_key:
|
|
185
169
|
specification_version: 4
|
|
186
170
|
summary: Ruby language binding for FUSE
|
|
187
171
|
test_files: []
|
|
188
|
-
has_rdoc: yard
|
data/.travis.yml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
sudo: required
|
|
3
|
-
dist: trusty
|
|
4
|
-
language: ruby
|
|
5
|
-
|
|
6
|
-
rvm:
|
|
7
|
-
- "2.1"
|
|
8
|
-
|
|
9
|
-
before_install:
|
|
10
|
-
- sudo apt-get update -y
|
|
11
|
-
- sudo apt-get install -qq pkg-config fuse libfuse-dev
|
|
12
|
-
- sudo modprobe fuse
|
|
13
|
-
- sudo chmod 666 /dev/fuse
|
|
14
|
-
- sudo chown root:$USER /etc/fuse.conf
|
|
15
|
-
|
|
16
|
-
script:
|
|
17
|
-
- bundle exec rake spec
|
|
18
|
-
|
|
19
|
-
cache:
|
|
20
|
-
bundler: true
|
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env rake
|
|
2
|
-
require "bundler/gem_tasks"
|
|
3
|
-
require 'yard'
|
|
4
|
-
require 'rspec/core/rake_task'
|
|
5
|
-
require 'rake/extensiontask'
|
|
6
|
-
|
|
7
|
-
CLOBBER.include("pkg","doc")
|
|
8
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
-
|
|
10
|
-
YARD::Rake::YardocTask.new
|
|
11
|
-
|
|
12
|
-
Rake::ExtensionTask.new('rfuse') do |ext|
|
|
13
|
-
ext.lib_dir = "lib/rfuse"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
task :spec => :compile
|
|
17
|
-
task :default => :spec
|
data/ext/.gitignore
DELETED
data/rfuse.gemspec
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
|
3
|
-
require "rfuse/version"
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |s|
|
|
6
|
-
s.name = "rfuse"
|
|
7
|
-
s.version = RFuse::VERSION
|
|
8
|
-
s.platform = Gem::Platform::RUBY
|
|
9
|
-
s.authors = ["Grant Gardner"]
|
|
10
|
-
s.email = ["grant@lastweekend.com.au"]
|
|
11
|
-
s.homepage = "http://rubygems.org/gems/rfuse"
|
|
12
|
-
s.summary = %q{Ruby language binding for FUSE}
|
|
13
|
-
s.description = %q{Write userspace filesystems in Ruby}
|
|
14
|
-
|
|
15
|
-
s.files = `git ls-files`.split("\n")
|
|
16
|
-
s.extensions = 'ext/rfuse/extconf.rb'
|
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
19
|
-
s.require_paths = ["lib"]
|
|
20
|
-
|
|
21
|
-
s.has_rdoc = 'yard'
|
|
22
|
-
s.extra_rdoc_files = 'CHANGES.md'
|
|
23
|
-
|
|
24
|
-
s.add_development_dependency("rake")
|
|
25
|
-
s.add_development_dependency("rake-compiler")
|
|
26
|
-
s.add_development_dependency("rspec","~> 3.0.0")
|
|
27
|
-
s.add_development_dependency("yard")
|
|
28
|
-
s.add_development_dependency("redcarpet")
|
|
29
|
-
s.add_development_dependency("ffi-xattr")
|
|
30
|
-
s.add_development_dependency("sys-filesystem")
|
|
31
|
-
end
|
data/sample/test-ruby.rb
DELETED
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/ruby
|
|
2
|
-
|
|
3
|
-
# TestFS for RFuse
|
|
4
|
-
|
|
5
|
-
require "rfuse"
|
|
6
|
-
|
|
7
|
-
class MyDir < Hash
|
|
8
|
-
attr_accessor :name, :mode , :actime, :modtime, :uid, :gid
|
|
9
|
-
def initialize(name,mode)
|
|
10
|
-
@uid=0
|
|
11
|
-
@gid=0
|
|
12
|
-
@actime=Time.now
|
|
13
|
-
@modtime=Time.now
|
|
14
|
-
@xattr=Hash.new
|
|
15
|
-
@name=name
|
|
16
|
-
@mode=mode
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def stat
|
|
20
|
-
RFuse::Stat.directory(mode,:uid => uid, :gid => gid, :atime => actime, :mtime => modtime,
|
|
21
|
-
:size => size)
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def listxattr()
|
|
25
|
-
@xattr.keys()
|
|
26
|
-
end
|
|
27
|
-
def setxattr(name,value,flag)
|
|
28
|
-
@xattr[name]=value #TODO:don't ignore flag
|
|
29
|
-
end
|
|
30
|
-
def getxattr(name)
|
|
31
|
-
return @xattr[name]
|
|
32
|
-
end
|
|
33
|
-
def removexattr(name)
|
|
34
|
-
@xattr.delete(name)
|
|
35
|
-
end
|
|
36
|
-
def size
|
|
37
|
-
return 48 #for testing only
|
|
38
|
-
end
|
|
39
|
-
def isdir
|
|
40
|
-
true
|
|
41
|
-
end
|
|
42
|
-
def insert_obj(obj,path)
|
|
43
|
-
d=self.search(File.dirname(path))
|
|
44
|
-
if d.isdir then
|
|
45
|
-
d[obj.name]=obj
|
|
46
|
-
else
|
|
47
|
-
raise Errno::ENOTDIR.new(d.name)
|
|
48
|
-
end
|
|
49
|
-
return d
|
|
50
|
-
end
|
|
51
|
-
def remove_obj(path)
|
|
52
|
-
d=self.search(File.dirname(path))
|
|
53
|
-
d.delete(File.basename(path))
|
|
54
|
-
end
|
|
55
|
-
def search(path)
|
|
56
|
-
p=path.split('/').delete_if {|x| x==''}
|
|
57
|
-
if p.length==0 then
|
|
58
|
-
return self
|
|
59
|
-
else
|
|
60
|
-
return self.follow(p)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
def follow (path_array)
|
|
64
|
-
if path_array.length==0 then
|
|
65
|
-
return self
|
|
66
|
-
else
|
|
67
|
-
d=self[path_array.shift]
|
|
68
|
-
if d then
|
|
69
|
-
return d.follow(path_array)
|
|
70
|
-
else
|
|
71
|
-
raise Errno::ENOENT.new
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
def to_s
|
|
76
|
-
return "Dir: " + @name + "(" + @mode.to_s + ")"
|
|
77
|
-
end
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
class MyFile
|
|
81
|
-
attr_accessor :name, :mode, :actime, :modtime, :uid, :gid, :content
|
|
82
|
-
def initialize(name,mode,uid,gid)
|
|
83
|
-
@actime=0
|
|
84
|
-
@modtime=0
|
|
85
|
-
@xattr=Hash.new
|
|
86
|
-
@content=""
|
|
87
|
-
@uid=uid
|
|
88
|
-
@gid=gid
|
|
89
|
-
@name=name
|
|
90
|
-
@mode=mode
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
def stat
|
|
94
|
-
RFuse::Stat.file(mode,:uid => uid, :gid => gid, :atime => actime, :mtime => modtime,
|
|
95
|
-
:size => size)
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def listxattr()
|
|
99
|
-
@xattr.keys
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def setxattr(name,value,flag)
|
|
103
|
-
@xattr[name]=value #TODO:don't ignore flag
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
def getxattr(name)
|
|
107
|
-
return @xattr[name]
|
|
108
|
-
end
|
|
109
|
-
def removexattr(name)
|
|
110
|
-
@xattr.delete(name)
|
|
111
|
-
end
|
|
112
|
-
def size
|
|
113
|
-
return content.size
|
|
114
|
-
end
|
|
115
|
-
def isdir
|
|
116
|
-
false
|
|
117
|
-
end
|
|
118
|
-
def follow(path_array)
|
|
119
|
-
if path_array.length != 0 then
|
|
120
|
-
raise Errno::ENOTDIR.new
|
|
121
|
-
else
|
|
122
|
-
return self
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
def to_s
|
|
126
|
-
return "File: " + @name + "(" + @mode.to_s + ")"
|
|
127
|
-
end
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
class MyFuse
|
|
131
|
-
|
|
132
|
-
def initialize(root)
|
|
133
|
-
@root=root
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
# The new readdir way, c+p-ed from getdir
|
|
137
|
-
def readdir(ctx,path,filler,offset,ffi)
|
|
138
|
-
d=@root.search(path)
|
|
139
|
-
if d.isdir then
|
|
140
|
-
d.each {|name,obj|
|
|
141
|
-
filler.push(name,obj.stat,0)
|
|
142
|
-
}
|
|
143
|
-
else
|
|
144
|
-
raise Errno::ENOTDIR.new(path)
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def getattr(ctx,path)
|
|
149
|
-
d = @root.search(path)
|
|
150
|
-
return d.stat
|
|
151
|
-
end #getattr
|
|
152
|
-
|
|
153
|
-
def mkdir(ctx,path,mode)
|
|
154
|
-
@root.insert_obj(MyDir.new(File.basename(path),mode),path)
|
|
155
|
-
end #mkdir
|
|
156
|
-
|
|
157
|
-
def mknod(ctx,path,mode,major,minor)
|
|
158
|
-
@root.insert_obj(MyFile.new(File.basename(path),mode,ctx.uid,ctx.gid),path)
|
|
159
|
-
end #mknod
|
|
160
|
-
|
|
161
|
-
def open(ctx,path,ffi)
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
#def release(ctx,path,fi)
|
|
165
|
-
#end
|
|
166
|
-
|
|
167
|
-
#def flush(ctx,path,fi)
|
|
168
|
-
#end
|
|
169
|
-
|
|
170
|
-
def chmod(ctx,path,mode)
|
|
171
|
-
d=@root.search(path)
|
|
172
|
-
d.mode=mode
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
def chown(ctx,path,uid,gid)
|
|
176
|
-
d=@root.search(path)
|
|
177
|
-
d.uid=uid
|
|
178
|
-
d.gid=gid
|
|
179
|
-
end
|
|
180
|
-
|
|
181
|
-
def truncate(ctx,path,offset)
|
|
182
|
-
d=@root.search(path)
|
|
183
|
-
d.content = d.content[0..offset]
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
def utime(ctx,path,actime,modtime)
|
|
187
|
-
d=@root.search(path)
|
|
188
|
-
d.actime=actime
|
|
189
|
-
d.modtime=modtime
|
|
190
|
-
end
|
|
191
|
-
|
|
192
|
-
def unlink(ctx,path)
|
|
193
|
-
@root.remove_obj(path)
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
def rmdir(ctx,path)
|
|
197
|
-
@root.remove_obj(path)
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
#def symlink(ctx,path,as)
|
|
201
|
-
#end
|
|
202
|
-
|
|
203
|
-
def rename(ctx,path,as)
|
|
204
|
-
d = @root.search(path)
|
|
205
|
-
@root.remove_obj(path)
|
|
206
|
-
@root.insert_obj(d,path)
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
#def link(ctx,path,as)
|
|
210
|
-
#end
|
|
211
|
-
|
|
212
|
-
def read(ctx,path,size,offset,fi)
|
|
213
|
-
d = @root.search(path)
|
|
214
|
-
if (d.isdir)
|
|
215
|
-
raise Errno::EISDIR.new(path)
|
|
216
|
-
return nil
|
|
217
|
-
else
|
|
218
|
-
return d.content[offset..offset + size - 1]
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
def write(ctx,path,buf,offset,fi)
|
|
223
|
-
d=@root.search(path)
|
|
224
|
-
if (d.isdir)
|
|
225
|
-
raise Errno::EISDIR.new(path)
|
|
226
|
-
else
|
|
227
|
-
d.content[offset..offset+buf.length - 1] = buf
|
|
228
|
-
end
|
|
229
|
-
return buf.length
|
|
230
|
-
end
|
|
231
|
-
|
|
232
|
-
def setxattr(ctx,path,name,value,size,flags)
|
|
233
|
-
d=@root.search(path)
|
|
234
|
-
d.setxattr(name,value,flags)
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
def getxattr(ctx,path,name)
|
|
238
|
-
d=@root.search(path)
|
|
239
|
-
if (d)
|
|
240
|
-
value=d.getxattr(name)
|
|
241
|
-
if (!value)
|
|
242
|
-
value=""
|
|
243
|
-
#raise Errno::ENOENT.new #TODO raise the correct error :
|
|
244
|
-
#NOATTR which is not implemented in Linux/glibc
|
|
245
|
-
end
|
|
246
|
-
else
|
|
247
|
-
raise Errno::ENOENT.new
|
|
248
|
-
end
|
|
249
|
-
return value
|
|
250
|
-
end
|
|
251
|
-
|
|
252
|
-
def listxattr(ctx,path)
|
|
253
|
-
d=@root.search(path)
|
|
254
|
-
value= d.listxattr()
|
|
255
|
-
return value
|
|
256
|
-
end
|
|
257
|
-
|
|
258
|
-
def removexattr(ctx,path,name)
|
|
259
|
-
d=@root.search(path)
|
|
260
|
-
d.removexattr(name)
|
|
261
|
-
end
|
|
262
|
-
|
|
263
|
-
#def opendir(ctx,path,ffi)
|
|
264
|
-
#end
|
|
265
|
-
|
|
266
|
-
#def releasedir(ctx,path,ffi)
|
|
267
|
-
#end
|
|
268
|
-
|
|
269
|
-
#def fsyncdir(ctx,path,meta,ffi)
|
|
270
|
-
#end
|
|
271
|
-
|
|
272
|
-
# Some random numbers to show with df command
|
|
273
|
-
def statfs(ctx,path)
|
|
274
|
-
s = RFuse::StatVfs.new()
|
|
275
|
-
s.f_bsize = 1024
|
|
276
|
-
s.f_frsize = 1024
|
|
277
|
-
s.f_blocks = 1000000
|
|
278
|
-
s.f_bfree = 500000
|
|
279
|
-
s.f_bavail = 990000
|
|
280
|
-
s.f_files = 10000
|
|
281
|
-
s.f_ffree = 9900
|
|
282
|
-
s.f_favail = 9900
|
|
283
|
-
s.f_fsid = 23423
|
|
284
|
-
s.f_flag = 0
|
|
285
|
-
s.f_namemax = 10000
|
|
286
|
-
return s
|
|
287
|
-
end
|
|
288
|
-
|
|
289
|
-
def ioctl(ctx, path, cmd, arg, ffi, flags, data)
|
|
290
|
-
# FT: I was not been able to test it.
|
|
291
|
-
print "*** IOCTL: command: ", cmd, "\n"
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def poll(ctx, path, ffi, ph, reventsp)
|
|
295
|
-
print "*** POLL: ", path, "\n"
|
|
296
|
-
# This is how we notify the caller if something happens:
|
|
297
|
-
ph.notifyPoll();
|
|
298
|
-
# when the GC harvests the object it calls fuse_pollhandle_destroy
|
|
299
|
-
# by itself.
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
def init(ctx,rfuseconninfo)
|
|
303
|
-
print "RFuse TestFS started\n"
|
|
304
|
-
print "init called\n"
|
|
305
|
-
print "proto_major:#{rfuseconninfo.proto_major}\n"
|
|
306
|
-
end
|
|
307
|
-
|
|
308
|
-
end #class Fuse
|
|
309
|
-
|
|
310
|
-
RFuse.main(ARGV) { fs = MyFuse.new(MyDir.new("",0777)) }
|