rfuse 1.0.5 → 1.1.0.RC0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +2 -0
- data/CHANGES.md +12 -0
- data/README.md +7 -9
- data/ext/rfuse/context.c +13 -2
- data/ext/rfuse/file_info.c +4 -1
- data/ext/rfuse/filler.c +1 -1
- data/ext/rfuse/rfuse.c +24 -6
- data/lib/rfuse/version.rb +1 -1
- data/lib/rfuse.rb +362 -41
- data/rfuse.gemspec +1 -1
- data/sample/test-ruby.rb +7 -36
- data/spec/basic_spec.rb +4 -6
- data/spec/fuse_file_info_spec.rb +6 -6
- data/spec/main_spec.rb +161 -0
- data/spec/options_spec.rb +22 -22
- data/spec/ruby_loop_spec.rb +15 -17
- data/spec/run_spec.rb +60 -0
- data/spec/signals_spec.rb +108 -0
- data/spec/spec_helper.rb +56 -10
- data/spec/xattr_spec.rb +1 -1
- metadata +29 -49
- data/.travis.disabled.yml +0 -8
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4f29302292efd2fca5a366cb8c385b9d7911398b
|
4
|
+
data.tar.gz: 6e83c7bfafa3a0d770be17bfb1ef45568bad0c66
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c311a008c40bb1ec20b2a929b348e95cccca0181f93bd3ce93f19e29f9e0ea62907feb30d763a0695f42409f9efb2655a3497b20204f867ccbd32384685ebbf6
|
7
|
+
data.tar.gz: 608b039f1efdadf041935b208c79ad10266cb0a33adc7bdf896cc6ed1da758dafcfaab969f9e1027ba7bfc3d23ee2cc52133c8f64c866ce78a2301d1d6ba2ba5
|
data/.yardopts
CHANGED
data/CHANGES.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
1.1.0 - 2014/MM/DD
|
2
|
+
------------------
|
3
|
+
|
4
|
+
* {RFuse::Fuse#trap_signals} a clean way of handling signals (with the self-pipe previously used for a graceful exit)
|
5
|
+
* Default signal handlers for "INT","TERM" (exit fuse), "USR1" (toggle FuseDelegator debugging)
|
6
|
+
* Introduce {RFuse.main} as Ruby equivalent of fuse_main() convenience method for starting filesystems
|
7
|
+
|
8
|
+
1.0.5 - 2014/04/16
|
9
|
+
------------------
|
10
|
+
|
11
|
+
Bugfixes
|
12
|
+
|
1
13
|
1.0.4 - 2013/12/19
|
2
14
|
------------------
|
3
15
|
|
data/README.md
CHANGED
@@ -20,25 +20,23 @@ Dependencies
|
|
20
20
|
Installation
|
21
21
|
---------------
|
22
22
|
|
23
|
-
|
23
|
+
gem install rfuse
|
24
24
|
|
25
25
|
Creating a filesystem
|
26
26
|
---------------------------
|
27
27
|
|
28
|
-
|
28
|
+
Create your filesystem as a class implementing the abstract FUSE methods from {RFuse::Fuse} as necessary.
|
29
|
+
|
30
|
+
Run it with {RFuse.main}
|
29
31
|
|
30
32
|
For a sample filesystem see sample/test-ruby.rb
|
31
33
|
|
32
34
|
To run the example:
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
..and there should be an empty in-memory filesystem mounted at /tmp/fuse
|
38
|
-
|
39
|
-
$ fusermount -u /tmp/fuse
|
36
|
+
mkdir /tmp/fuse
|
37
|
+
ruby sample/test-ruby.rb /tmp/fuse
|
40
38
|
|
41
|
-
|
39
|
+
there should be an empty in-memory filesystem mounted at `/tmp/fuse`
|
42
40
|
|
43
41
|
HISTORY
|
44
42
|
======
|
data/ext/rfuse/context.c
CHANGED
@@ -10,7 +10,7 @@ VALUE wrap_context (struct fuse_context *fctx) {
|
|
10
10
|
}
|
11
11
|
|
12
12
|
/*
|
13
|
-
@
|
13
|
+
@private
|
14
14
|
*/
|
15
15
|
VALUE context_initialize(VALUE self){
|
16
16
|
return self;
|
@@ -25,7 +25,7 @@ VALUE context_new(VALUE class){
|
|
25
25
|
}
|
26
26
|
|
27
27
|
/*
|
28
|
-
|
28
|
+
@return [Integer] User id of the caller
|
29
29
|
*/
|
30
30
|
VALUE context_uid(VALUE self){
|
31
31
|
struct fuse_context *ctx;
|
@@ -51,6 +51,14 @@ VALUE context_pid(VALUE self){
|
|
51
51
|
return INT2FIX(ctx->pid);
|
52
52
|
}
|
53
53
|
|
54
|
+
/*
|
55
|
+
* @return [Fuse] the fuse object
|
56
|
+
*/
|
57
|
+
VALUE context_fuse(VALUE self) {
|
58
|
+
struct fuse_context *ctx;
|
59
|
+
Data_Get_Struct(self,struct fuse_context,ctx);
|
60
|
+
return (VALUE) ctx->private_data;
|
61
|
+
}
|
54
62
|
/*
|
55
63
|
Document-class: RFuse::Context
|
56
64
|
Context object passed to every fuse operation
|
@@ -58,6 +66,8 @@ VALUE context_pid(VALUE self){
|
|
58
66
|
void context_init(VALUE module) {
|
59
67
|
#if 0
|
60
68
|
module = rb_define_module("RFuse");
|
69
|
+
|
70
|
+
|
61
71
|
#endif
|
62
72
|
|
63
73
|
VALUE cContext=rb_define_class_under(module,"Context",rb_cObject);
|
@@ -66,4 +76,5 @@ void context_init(VALUE module) {
|
|
66
76
|
rb_define_method(cContext,"uid",context_uid,0);
|
67
77
|
rb_define_method(cContext,"gid",context_gid,0);
|
68
78
|
rb_define_method(cContext,"pid",context_pid,0);
|
79
|
+
rb_define_method(cContext,"fuse",context_fuse,0);
|
69
80
|
}
|
data/ext/rfuse/file_info.c
CHANGED
@@ -56,6 +56,9 @@ VALUE release_file_info(struct fuse_context *ctx, struct fuse_file_info *ffi)
|
|
56
56
|
|
57
57
|
}
|
58
58
|
|
59
|
+
/*
|
60
|
+
* @private
|
61
|
+
*/
|
59
62
|
VALUE file_info_initialize(VALUE self){
|
60
63
|
return self;
|
61
64
|
}
|
@@ -135,7 +138,7 @@ void file_info_init(VALUE module) {
|
|
135
138
|
rb_define_method(cFileInfo,"nonseekable=",file_info_nonseekable_assign,1);
|
136
139
|
|
137
140
|
/*
|
138
|
-
|
141
|
+
@return [Object] user specified filehandle object. See {Fuse#open}
|
139
142
|
*/
|
140
143
|
rb_define_attr(cFileInfo,"fh",1,1);
|
141
144
|
}
|
data/ext/rfuse/filler.c
CHANGED
data/ext/rfuse/rfuse.c
CHANGED
@@ -1778,18 +1778,32 @@ VALUE rf_process(VALUE self)
|
|
1778
1778
|
* @param [Array<String>] options fuse arguments (-h to see a list)
|
1779
1779
|
*/
|
1780
1780
|
static VALUE rf_initialize(
|
1781
|
-
|
1782
|
-
VALUE
|
1783
|
-
VALUE
|
1781
|
+
int argc,
|
1782
|
+
VALUE* argv,
|
1783
|
+
VALUE self)
|
1784
1784
|
{
|
1785
1785
|
|
1786
|
+
VALUE opts;
|
1787
|
+
VALUE first_opt;
|
1788
|
+
VALUE mountpoint_arg;
|
1786
1789
|
VALUE mountpoint;
|
1787
1790
|
struct intern_fuse *inf;
|
1788
1791
|
int init_result;
|
1789
1792
|
struct fuse_args *args;
|
1790
1793
|
|
1794
|
+
rb_scan_args(argc, argv, "1*",&mountpoint_arg, &opts);
|
1795
|
+
|
1796
|
+
// Allow pre 1.0.6 style Fuse which forced options to be passed as an array
|
1797
|
+
if (RARRAY_LEN(opts) == 1) {
|
1798
|
+
first_opt = rb_ary_entry(opts,0);
|
1799
|
+
if (TYPE(first_opt) == T_ARRAY) {
|
1800
|
+
opts = first_opt;
|
1801
|
+
}
|
1802
|
+
}
|
1791
1803
|
//Allow things like Pathname to be sent as a mountpoint
|
1792
|
-
mountpoint = rb_obj_as_string(
|
1804
|
+
mountpoint = rb_obj_as_string(mountpoint_arg);
|
1805
|
+
|
1806
|
+
//Is this redundant if scan_args has populted opts?
|
1793
1807
|
Check_Type(opts, T_ARRAY);
|
1794
1808
|
|
1795
1809
|
Data_Get_Struct(self,struct intern_fuse,inf);
|
@@ -1930,12 +1944,17 @@ void rfuse_init(VALUE module)
|
|
1930
1944
|
VALUE cFuse;
|
1931
1945
|
|
1932
1946
|
mRFuse = module;
|
1947
|
+
|
1948
|
+
// The underlying FUSE library major version
|
1949
|
+
rb_define_const(mRFuse,"FUSE_MAJOR_VERSION",INT2FIX(FUSE_MAJOR_VERSION));
|
1950
|
+
// The underlyfing FUSE library minor versoin
|
1951
|
+
rb_define_const(mRFuse,"FUSE_MINOR_VERSION",INT2FIX(FUSE_MINOR_VERSION));
|
1933
1952
|
|
1934
1953
|
cFuse = rb_define_class_under(mRFuse,"Fuse",rb_cObject);
|
1935
1954
|
|
1936
1955
|
rb_define_alloc_func(cFuse,rf_new);
|
1937
1956
|
|
1938
|
-
rb_define_method(cFuse,"initialize",rf_initialize
|
1957
|
+
rb_define_method(cFuse,"initialize",rf_initialize,-1);
|
1939
1958
|
rb_define_method(cFuse,"mounted?",rf_mounted,0);
|
1940
1959
|
rb_define_method(cFuse,"invalidate",rf_invalidate,1);
|
1941
1960
|
rb_define_method(cFuse,"unmount",rf_unmount,0);
|
@@ -1978,7 +1997,6 @@ void rfuse_init(VALUE module)
|
|
1978
1997
|
rb_define_method(cFuse,"releasedir",unsafe_releasedir,0);
|
1979
1998
|
rb_define_method(cFuse,"fsyncdir",unsafe_fsyncdir,0);
|
1980
1999
|
rb_define_method(cFuse,"init",unsafe_init,0);
|
1981
|
-
rb_define_method(cFuse,"destroy",unsafe_destroy,0);
|
1982
2000
|
rb_define_method(cFuse,"access",unsafe_access,0);
|
1983
2001
|
rb_define_method(cFuse,"create",unsafe_create,0);
|
1984
2002
|
rb_define_method(cFuse,"ftruncate",unsafe_ftruncate,0);
|
data/lib/rfuse/version.rb
CHANGED