rfuse 1.2.3 → 2.0.0.ffilibfuse

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfuse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 2.0.0.ffilibfuse
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grant Gardner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-19 00:00:00.000000000 Z
11
+ date: 2023-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ffi-libfuse
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.4
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -112,37 +126,21 @@ description: Write userspace filesystems in Ruby
112
126
  email:
113
127
  - grant@lastweekend.com.au
114
128
  executables: []
115
- extensions:
116
- - ext/rfuse/extconf.rb
117
- extra_rdoc_files:
118
- - CHANGES.md
129
+ extensions: []
130
+ extra_rdoc_files: []
119
131
  files:
120
132
  - ".yardopts"
121
- - CHANGES.md
133
+ - CHANGELOG.md
122
134
  - LICENSE
123
135
  - README.md
124
- - ext/rfuse/bufferwrapper.c
125
- - ext/rfuse/bufferwrapper.h
126
- - ext/rfuse/context.c
127
- - ext/rfuse/context.h
128
- - ext/rfuse/extconf.rb
129
- - ext/rfuse/file_info.c
130
- - ext/rfuse/file_info.h
131
- - ext/rfuse/filler.c
132
- - ext/rfuse/filler.h
133
- - ext/rfuse/helper.c
134
- - ext/rfuse/helper.h
135
- - ext/rfuse/intern_rfuse.c
136
- - ext/rfuse/intern_rfuse.h
137
- - ext/rfuse/pollhandle.c
138
- - ext/rfuse/pollhandle.h
139
- - ext/rfuse/rfuse.c
140
- - ext/rfuse/rfuse.h
141
- - ext/rfuse/rfuse_mod.c
142
- - ext/rfuse/ruby-compat.h
143
136
  - lib/rfuse-ng.rb
144
137
  - lib/rfuse.rb
145
138
  - lib/rfuse/compat.rb
139
+ - lib/rfuse/flock.rb
140
+ - lib/rfuse/gem_version.rb
141
+ - lib/rfuse/rfuse.rb
142
+ - lib/rfuse/stat.rb
143
+ - lib/rfuse/statvfs.rb
146
144
  - lib/rfuse/version.rb
147
145
  - lib/rfuse_ng.rb
148
146
  homepage: http://rubygems.org/gems/rfuse
@@ -157,14 +155,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
155
  requirements:
158
156
  - - ">="
159
157
  - !ruby/object:Gem::Version
160
- version: '2.5'
158
+ version: '2.7'
161
159
  required_rubygems_version: !ruby/object:Gem::Requirement
162
160
  requirements:
163
- - - ">="
161
+ - - ">"
164
162
  - !ruby/object:Gem::Version
165
- version: '0'
163
+ version: 1.3.1
166
164
  requirements: []
167
- rubygems_version: 3.0.8
165
+ rubygems_version: 3.1.6
168
166
  signing_key:
169
167
  specification_version: 4
170
168
  summary: Ruby language binding for FUSE
@@ -1,48 +0,0 @@
1
- #include <stdlib.h>
2
- #include <ruby.h>
3
- #include <fuse.h>
4
-
5
- #include "bufferwrapper.h"
6
-
7
- VALUE bufferwrapper_new(VALUE class)
8
- {
9
- rb_raise(rb_eNotImpError, "new() not implemented (it has no use), and should not be called");
10
- return Qnil;
11
- }
12
-
13
- VALUE bufferwrapper_initialize(VALUE self)
14
- {
15
- return self;
16
- }
17
-
18
- VALUE bufferwrapper_getdata(VALUE self, VALUE size)
19
- {
20
- void *buf;
21
-
22
- Data_Get_Struct(self, void, buf);
23
-
24
- return rb_str_new(buf, FIX2INT(size));
25
- }
26
-
27
- VALUE wrap_buffer(void *buf)
28
- {
29
- VALUE rRFuse;
30
- VALUE rBufferWrapper;
31
-
32
- rRFuse = rb_const_get(rb_cObject,rb_intern("RFuse"));
33
- rBufferWrapper = rb_const_get(rRFuse,rb_intern("BufferWrapper"));
34
-
35
- return Data_Wrap_Struct(rBufferWrapper, NULL, NULL, buf);
36
- }
37
-
38
- VALUE bufferwrapper_init(VALUE module)
39
- {
40
- VALUE cBufferWrapper = rb_define_class_under(module,"BufferWrapper",rb_cObject);
41
-
42
- rb_define_alloc_func(cBufferWrapper,bufferwrapper_new);
43
-
44
- rb_define_method(cBufferWrapper,"initialize",bufferwrapper_initialize,0);
45
- rb_define_method(cBufferWrapper,"getData",bufferwrapper_getdata,1);
46
-
47
- return cBufferWrapper;
48
- }
@@ -1,10 +0,0 @@
1
- #include <fuse.h>
2
- #include <ruby.h>
3
-
4
- VALUE wrap_buffer(void *buf);
5
-
6
- VALUE bufferwrapper_new(VALUE class);
7
- VALUE bufferwrapper_getdata(VALUE self, VALUE size);
8
- VALUE bufferwrapper_init(VALUE module);
9
-
10
- VALUE bufferwrapper_initialize(VALUE self);
data/ext/rfuse/context.c DELETED
@@ -1,80 +0,0 @@
1
- #include "context.h"
2
- #include <fuse.h>
3
-
4
- VALUE wrap_context (struct fuse_context *fctx) {
5
- VALUE rRFuse;
6
- VALUE rContext;
7
- rRFuse=rb_const_get(rb_cObject,rb_intern("RFuse"));
8
- rContext=rb_const_get(rRFuse,rb_intern("Context"));
9
- return Data_Wrap_Struct(rContext,0,0,fctx); //shouldn't be freed!
10
- }
11
-
12
- /*
13
- @private
14
- */
15
- VALUE context_initialize(VALUE self){
16
- return self;
17
- }
18
-
19
- //This should never be called!
20
- VALUE context_new(VALUE class){
21
- VALUE self;
22
- struct fuse_context *ctx;
23
- self = Data_Make_Struct(class, struct fuse_context, 0,free,ctx);
24
- return self;
25
- }
26
-
27
- /*
28
- @return [Integer] User id of the caller
29
- */
30
- VALUE context_uid(VALUE self){
31
- struct fuse_context *ctx;
32
- Data_Get_Struct(self,struct fuse_context,ctx);
33
- return INT2FIX(ctx->uid);
34
- }
35
-
36
- /*
37
- @return [Integer] Group id of the caller
38
- */
39
- VALUE context_gid(VALUE self){
40
- struct fuse_context *ctx;
41
- Data_Get_Struct(self,struct fuse_context,ctx);
42
- return INT2FIX(ctx->gid);
43
- }
44
-
45
- /*
46
- @return [Integer] Process id of the calling process
47
- */
48
- VALUE context_pid(VALUE self){
49
- struct fuse_context *ctx;
50
- Data_Get_Struct(self,struct fuse_context,ctx);
51
- return INT2FIX(ctx->pid);
52
- }
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
- }
62
- /*
63
- Document-class: RFuse::Context
64
- Context object passed to every fuse operation
65
- */
66
- void context_init(VALUE module) {
67
- #if 0
68
- module = rb_define_module("RFuse");
69
-
70
-
71
- #endif
72
-
73
- VALUE cContext=rb_define_class_under(module,"Context",rb_cObject);
74
- rb_define_alloc_func(cContext,context_new);
75
- rb_define_method(cContext,"initialize",context_initialize,0);
76
- rb_define_method(cContext,"uid",context_uid,0);
77
- rb_define_method(cContext,"gid",context_gid,0);
78
- rb_define_method(cContext,"pid",context_pid,0);
79
- rb_define_method(cContext,"fuse",context_fuse,0);
80
- }
data/ext/rfuse/context.h DELETED
@@ -1,5 +0,0 @@
1
- #include <fuse.h>
2
- #include <ruby.h>
3
-
4
- VALUE wrap_context ();
5
- void context_init(VALUE module);
data/ext/rfuse/extconf.rb DELETED
@@ -1,17 +0,0 @@
1
- require 'mkmf'
2
-
3
- $CFLAGS << ' -Wall'
4
- #$CFLAGS << ' -Werror'
5
- $CFLAGS << ' -D_FILE_OFFSET_BITS=64'
6
- $CFLAGS << ' -DFUSE_USE_VERSION=26'
7
-
8
-
9
- have_func("rb_errinfo")
10
-
11
- have_func("rb_set_errinfo")
12
-
13
- if have_library('fuse')
14
- create_makefile('rfuse/rfuse')
15
- else
16
- puts "No FUSE install available"
17
- end
@@ -1,144 +0,0 @@
1
- #include "file_info.h"
2
- #include <fuse.h>
3
-
4
- //creates a FileInfo object from an already allocated ffi
5
- VALUE wrap_file_info(struct fuse_context *ctx, struct fuse_file_info *ffi) {
6
- VALUE rRFuse;
7
- VALUE rFileInfo;
8
-
9
- VALUE rffi;
10
-
11
- VALUE open_files;
12
- VALUE key;
13
-
14
- rRFuse=rb_const_get(rb_cObject,rb_intern("RFuse"));
15
- rFileInfo=rb_const_get(rRFuse,rb_intern("FileInfo"));
16
-
17
- rffi = Data_Wrap_Struct(rFileInfo,0,0,ffi);
18
-
19
- //store the wrapped ffi back into the struct so we don't have to keep wrapping it
20
- ffi->fh = rffi;
21
-
22
- //also store it in an open_files hash on the fuse_object
23
- //so it doesn't get GC'd
24
- open_files = rb_iv_get((VALUE) ctx->private_data,"@open_files");
25
- key = rb_funcall(rffi,rb_intern("object_id"),0);
26
- rb_hash_aset(open_files,key,rffi);
27
-
28
- return rffi;
29
- };
30
-
31
- //returns a previously wrapped ffi
32
- VALUE get_file_info(struct fuse_file_info *ffi) {
33
-
34
- if (TYPE(ffi->fh) == T_DATA )
35
- return (VALUE) ffi->fh;
36
- else
37
- return Qnil;
38
-
39
- };
40
-
41
- //Allow the FileInfo object to be GC'd
42
- VALUE release_file_info(struct fuse_context *ctx, struct fuse_file_info *ffi)
43
- {
44
-
45
- if (TYPE(ffi->fh) == T_DATA) {
46
- VALUE rffi = ffi->fh;
47
- VALUE fuse_object = (VALUE) ctx->private_data;
48
- VALUE open_files = rb_iv_get(fuse_object,"@open_files");
49
- VALUE key = rb_funcall(rffi,rb_intern("object_id"),0);
50
- rb_hash_delete(open_files,key);
51
-
52
- return rffi;
53
- }
54
-
55
- return Qnil;
56
-
57
- }
58
-
59
- /*
60
- * @private
61
- */
62
- VALUE file_info_initialize(VALUE self){
63
- return self;
64
- }
65
-
66
- //TODO FT: test: this _should_not_ be called, an exception would do the trick :)
67
- VALUE file_info_new(VALUE class){
68
- rb_raise(rb_eNotImpError, "new() not implemented (it has no use), and should not be called");
69
- return Qnil;
70
- }
71
-
72
- VALUE file_info_writepage(VALUE self) {
73
- struct fuse_file_info *f;
74
- Data_Get_Struct(self,struct fuse_file_info,f);
75
- return INT2FIX(f->writepage);
76
- }
77
-
78
- VALUE file_info_flags(VALUE self) {
79
- struct fuse_file_info *f;
80
- Data_Get_Struct(self,struct fuse_file_info,f);
81
- return INT2FIX(f->flags);
82
- }
83
-
84
- VALUE file_info_direct(VALUE self) {
85
- struct fuse_file_info *f;
86
- Data_Get_Struct(self,struct fuse_file_info,f);
87
- if (TYPE(f->direct_io) != T_NONE) {
88
- return (VALUE) f->direct_io;
89
- } else {
90
- return Qnil;
91
- }
92
- }
93
-
94
- VALUE file_info_direct_assign(VALUE self,VALUE value) {
95
- struct fuse_file_info *f;
96
- Data_Get_Struct(self,struct fuse_file_info,f);
97
- f->direct_io = value;
98
- return value;
99
- }
100
-
101
- VALUE file_info_nonseekable(VALUE self) {
102
- struct fuse_file_info *f;
103
- Data_Get_Struct(self,struct fuse_file_info,f);
104
- if (TYPE(f->nonseekable) != T_NONE) {
105
- return (VALUE) f->nonseekable;
106
- } else {
107
- return Qnil;
108
- }
109
- }
110
-
111
- VALUE file_info_nonseekable_assign(VALUE self,VALUE value) {
112
- struct fuse_file_info *f;
113
- Data_Get_Struct(self,struct fuse_file_info,f);
114
- f->nonseekable = value;
115
- return value;
116
- }
117
-
118
- /*
119
- Document-class: RFuse::FileInfo
120
-
121
- Represents an open file (or directory) that is reused
122
- across multiple fuse operations
123
-
124
- */
125
- void file_info_init(VALUE module) {
126
- #if 0
127
- //Trick Yardoc
128
- module = rb_define_module("RFuse");
129
- #endif
130
- VALUE cFileInfo=rb_define_class_under(module,"FileInfo",rb_cObject);
131
- rb_define_alloc_func(cFileInfo,file_info_new);
132
- rb_define_method(cFileInfo,"initialize",file_info_initialize,0);
133
- rb_define_method(cFileInfo,"flags",file_info_flags,0);
134
- rb_define_method(cFileInfo,"writepage",file_info_writepage,0);
135
- rb_define_method(cFileInfo,"direct",file_info_direct,0);
136
- rb_define_method(cFileInfo,"direct=",file_info_direct_assign,1);
137
- rb_define_method(cFileInfo,"nonseekable",file_info_nonseekable,0);
138
- rb_define_method(cFileInfo,"nonseekable=",file_info_nonseekable_assign,1);
139
-
140
- /*
141
- @return [Object] user specified filehandle object. See {Fuse#open}
142
- */
143
- rb_define_attr(cFileInfo,"fh",1,1);
144
- }
@@ -1,13 +0,0 @@
1
- #include <fuse.h>
2
- #include <ruby.h>
3
-
4
- VALUE wrap_file_info(struct fuse_context *ctx, struct fuse_file_info *ffi);
5
- VALUE get_file_info(struct fuse_file_info *ffi);
6
- VALUE release_file_info(struct fuse_context *ctx, struct fuse_file_info *ffi);
7
-
8
- VALUE file_info_initialize(VALUE self);
9
- VALUE file_info_new(VALUE class);
10
- VALUE file_info_flags(VALUE self);
11
- VALUE file_info_writepage(VALUE self);
12
-
13
- void file_info_init(VALUE module);
data/ext/rfuse/filler.c DELETED
@@ -1,61 +0,0 @@
1
- #include "filler.h"
2
- #include <fuse.h>
3
- #include "helper.h"
4
-
5
- VALUE rfiller_initialize(VALUE self){
6
- return self;
7
- }
8
-
9
- /*
10
- * @private Never called
11
- */
12
- VALUE rfiller_new(VALUE class){
13
- VALUE self;
14
- struct filler_t *f;
15
- self = Data_Make_Struct(class, struct filler_t, 0,free,f);
16
- return self;
17
- }
18
-
19
- /*
20
- * Add a value into the filler
21
- * @param [String] name a file name
22
- * @param [Stat] stat Stat info representing the file, may be nil
23
- * @param [Integer] offset index of next entry, or zero
24
- *
25
- * @return self or nil if the buffer is full
26
- *
27
- */
28
- VALUE rfiller_push(VALUE self, VALUE name, VALUE stat, VALUE offset) {
29
- struct filler_t *f;
30
- int result;
31
-
32
- Data_Get_Struct(self,struct filler_t,f);
33
-
34
-
35
- //Allow nil return instead of a stat
36
- if (NIL_P(stat)) {
37
- result = f->filler(f->buffer,StringValueCStr(name),NULL,NUM2OFFT(offset));
38
- } else {
39
- struct stat st;
40
- memset(&st, 0, sizeof(st));
41
- rstat2stat(stat,&st);
42
- result = f->filler(f->buffer,StringValueCStr(name),&st,NUM2OFFT(offset));
43
- }
44
-
45
- return result ? Qnil : self;
46
- }
47
-
48
- /*
49
- * Document-class: RFuse::Filler
50
- * Used by {Fuse#readdir} to collect directory entries
51
- */
52
- void rfiller_init(VALUE module) {
53
-
54
- #if 0
55
- module = rb_define_module("RFuse");
56
- #endif
57
- VALUE cFiller=rb_define_class_under(module,"Filler",rb_cObject);
58
- rb_define_alloc_func(cFiller,rfiller_new);
59
- rb_define_method(cFiller,"initialize",rfiller_initialize,0);
60
- rb_define_method(cFiller,"push",rfiller_push,3);
61
- }
data/ext/rfuse/filler.h DELETED
@@ -1,15 +0,0 @@
1
- #include <fuse.h>
2
- #include <ruby.h>
3
-
4
- struct filler_t {
5
- fuse_fill_dir_t filler;
6
- void *buffer;
7
- fuse_dirh_t dh;
8
- fuse_dirfil_t df;
9
- };
10
-
11
- VALUE rfiller_initialize(VALUE self);
12
- VALUE rfiller_new(VALUE class);
13
- VALUE rfiller_push(VALUE self, VALUE name, VALUE stat, VALUE offset);
14
-
15
- void rfiller_init(VALUE module);
data/ext/rfuse/helper.c DELETED
@@ -1,97 +0,0 @@
1
- #include "helper.h"
2
-
3
- void rstat2stat(VALUE rstat, struct stat *statbuf)
4
- {
5
- ID to_i;
6
- VALUE r_atime,r_mtime,r_ctime;
7
-
8
- statbuf->st_dev = FIX2ULONG(rb_funcall(rstat,rb_intern("dev"),0));
9
- statbuf->st_ino = FIX2ULONG(rb_funcall(rstat,rb_intern("ino"),0));
10
- statbuf->st_mode = FIX2UINT(rb_funcall(rstat,rb_intern("mode"),0));
11
- statbuf->st_nlink = FIX2UINT(rb_funcall(rstat,rb_intern("nlink"),0));
12
- statbuf->st_uid = FIX2UINT(rb_funcall(rstat,rb_intern("uid"),0));
13
- statbuf->st_gid = FIX2UINT(rb_funcall(rstat,rb_intern("gid"),0));
14
- statbuf->st_rdev = FIX2ULONG(rb_funcall(rstat,rb_intern("rdev"),0));
15
- statbuf->st_size = NUM2OFFT(rb_funcall(rstat,rb_intern("size"),0));
16
- statbuf->st_blksize = NUM2SIZET(rb_funcall(rstat,rb_intern("blksize"),0));
17
- statbuf->st_blocks = NUM2SIZET(rb_funcall(rstat,rb_intern("blocks"),0));
18
-
19
- r_atime = rb_funcall(rstat,rb_intern("atime"),0);
20
- r_mtime = rb_funcall(rstat,rb_intern("mtime"),0);
21
- r_ctime = rb_funcall(rstat,rb_intern("ctime"),0);
22
-
23
- to_i = rb_intern("to_i");
24
-
25
- statbuf->st_atime = NUM2ULONG(rb_funcall(r_atime,to_i,0));
26
- statbuf->st_mtime = NUM2ULONG(rb_funcall(r_mtime,to_i,0));
27
- statbuf->st_ctime = NUM2ULONG(rb_funcall(r_ctime,to_i,0));
28
-
29
- //TODO: Find out the correct way to test for nano second resolution availability
30
- #ifdef _STATBUF_ST_NSEC
31
- {
32
- ID nsec;
33
- nsec = rb_intern("nsec");
34
-
35
- if (rb_respond_to(r_atime,nsec))
36
- statbuf->st_atim.tv_nsec = NUM2ULONG(rb_funcall(r_atime,nsec,0));
37
-
38
- if (rb_respond_to(r_mtime,nsec))
39
- statbuf->st_mtim.tv_nsec = NUM2ULONG(rb_funcall(r_mtime,nsec,0));
40
-
41
- if (rb_respond_to(r_ctime,nsec))
42
- statbuf->st_ctim.tv_nsec = NUM2ULONG(rb_funcall(r_ctime,nsec,0));
43
- }
44
- #endif
45
-
46
- }
47
-
48
- void rstatvfs2statvfs(VALUE rstatvfs,struct statvfs *statvfsbuf) {
49
- statvfsbuf->f_bsize = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_bsize"),0));
50
- statvfsbuf->f_frsize = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_frsize"),0));
51
- statvfsbuf->f_blocks = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_blocks"),0));
52
- statvfsbuf->f_bfree = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_bfree"),0));
53
- statvfsbuf->f_bavail = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_bavail"),0));
54
- statvfsbuf->f_files = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_files"),0));
55
- statvfsbuf->f_ffree = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_ffree"),0));
56
- statvfsbuf->f_favail = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_favail"),0));
57
- statvfsbuf->f_fsid = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_fsid"),0));
58
- statvfsbuf->f_flag = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_flag"),0));
59
- statvfsbuf->f_namemax = FIX2ULONG(rb_funcall(rstatvfs,rb_intern("f_namemax"),0));
60
- }
61
-
62
- void rfuseconninfo2fuseconninfo(VALUE rfuseconninfo,struct fuse_conn_info *fuseconninfo) {
63
- fuseconninfo->proto_major = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("proto_major"),0));
64
- fuseconninfo->proto_minor = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("proto_minor"),0));
65
- fuseconninfo->async_read = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("async_read"),0));
66
- fuseconninfo->max_write = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("max_write"),0));
67
- fuseconninfo->max_readahead = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("max_readahead"),0));
68
- fuseconninfo->capable = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("capable"),0));
69
- fuseconninfo->want = FIX2UINT(rb_funcall(rfuseconninfo,rb_intern("want"),0));
70
- }
71
-
72
- struct fuse_args * rarray2fuseargs(VALUE rarray){
73
-
74
- int i;
75
- struct fuse_args *args;
76
- //TODO - we probably don't want to execute the rest if the type check fails
77
- Check_Type(rarray, T_ARRAY);
78
-
79
- args = malloc(sizeof(struct fuse_args));
80
- args->argc = RARRAY_LEN(rarray) + 1;
81
- args->argv = malloc((args->argc + 1) * sizeof(char *));
82
- args->allocated = 1;
83
-
84
-
85
- args->argv[0] = strdup("");
86
-
87
- for(i = 0; i < args->argc - 1; i++) {
88
- VALUE v;
89
- v = RARRAY_PTR(rarray)[i];
90
- Check_Type(v, T_STRING);
91
- args->argv[i+1] = strdup(rb_string_value_ptr(&v));
92
- }
93
-
94
- args->argv[args->argc] = NULL;
95
-
96
- return args;
97
- }
data/ext/rfuse/helper.h DELETED
@@ -1,15 +0,0 @@
1
- #include <sys/stat.h>
2
- #include <sys/statvfs.h>
3
- #include <ruby.h>
4
- #include "ruby-compat.h"
5
- #include <fuse.h>
6
-
7
- #ifndef _RFUSE_HELPER_H
8
- #define _RFUSE_HELPER_H
9
-
10
- void rstat2stat(VALUE rstat,struct stat *statbuf);
11
- void rstatvfs2statvfs(VALUE rstatvfs,struct statvfs *statvfsbuf);
12
- void rfuseconninfo2fuseconninfo(VALUE rfuseconninfo,struct fuse_conn_info *fuseconninfo);
13
- struct fuse_args * rarray2fuseargs(VALUE rarray);
14
-
15
- #endif
@@ -1,79 +0,0 @@
1
- #include "intern_rfuse.h"
2
- #include <fuse/fuse_lowlevel.h>
3
- #include <stdio.h>
4
- #include <stdlib.h>
5
- #include <string.h>
6
-
7
- struct intern_fuse *intern_fuse_new() {
8
- struct intern_fuse *inf;
9
- inf = (struct intern_fuse *) malloc(sizeof(struct intern_fuse));
10
- memset(inf, 0, sizeof(*inf));
11
- memset(&inf->fuse_op, 0, sizeof(struct fuse_operations));
12
- return inf;
13
- }
14
-
15
-
16
- int intern_fuse_destroy(struct intern_fuse *inf){
17
- //you have to take care, that fuse is unmounted yourself!
18
- if(inf->fuse)
19
- fuse_destroy(inf->fuse);
20
- if(inf->mountpoint)
21
- free(inf->mountpoint);
22
- free(inf);
23
- return 0;
24
- }
25
-
26
- int intern_fuse_init(struct intern_fuse *inf, struct fuse_args *args, void* user_data)
27
- {
28
- struct fuse_chan* fc;
29
- char* mountpoint;
30
- mountpoint = inf->mountpoint;
31
- fc = fuse_mount(mountpoint,args);
32
-
33
- if (fc == NULL) {
34
- return -1;
35
- }
36
-
37
- inf->fuse=fuse_new(fc, args, &(inf->fuse_op), sizeof(struct fuse_operations), user_data);
38
-
39
- if (inf->fuse == NULL) {
40
- fuse_unmount(inf->mountpoint, fc);
41
- return -1;
42
- }
43
-
44
- inf->fc = fc;
45
-
46
- return 0;
47
- }
48
-
49
- // Return the /dev/fuse file descriptor for use with IO.select
50
- int intern_fuse_fd(struct intern_fuse *inf)
51
- {
52
- if (inf->fc == NULL) {
53
- return -1;
54
- }
55
-
56
- return fuse_chan_fd(inf->fc);
57
- }
58
-
59
- //Process one fuse command (ie after IO.select)
60
- int intern_fuse_process(struct intern_fuse *inf)
61
- {
62
- struct fuse_cmd *cmd;
63
-
64
- if (inf->fuse == NULL) {
65
- return -1;
66
- }
67
-
68
- if (fuse_exited(inf->fuse)) {
69
- return -1;
70
- }
71
-
72
- cmd = fuse_read_cmd(inf->fuse);
73
-
74
- if (cmd != NULL) {
75
- fuse_process_cmd(inf->fuse, cmd);
76
- }
77
-
78
- return 0;
79
- }