Skip to content

Commit

Permalink
moar wip
Browse files Browse the repository at this point in the history
  • Loading branch information
c4milo committed Mar 6, 2012
1 parent 4a59ef3 commit 81fd286
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.lock-wscript
*.swp
*.swo
build
node_modules
8 changes: 4 additions & 4 deletions design
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
var fuse = require('fuse');

var write = function () {
var write = function (, callback) {

};

var read = function() {
var read = function(, callback) {

};

var readdir = function() {
var readdir = function(, callback) {

};

Expand All @@ -19,5 +19,5 @@ var operations = {
readdir: readdir
};

fuse.mount(operations, mountpoint, flags);
fuse.mount(mountpoint, operations, flags);

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
}
],
"devDependencies": {
"mocha": "0.14.0"
"mocha": "0.14.0",
"should": "0.6.0"
},
"scripts": {
"install": "node-waf configure build"
},
"main" : "./fusejs"
"main" : "./fuse"
}
35 changes: 35 additions & 0 deletions src/bindings.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,40 @@
// Copyright 2012, Camilo Aguilar. Cloudescape, LLC.
#include "bindings.h"
namespace NodeFuse {
void Fuse::Initialize(Handle<Object> target) {
Local<FunctionTemplate> t = FunctionTemplate::New(Fuse::New);

t->InstanceTemplate()->SetInternalFieldCount(1);

NODE_SET_PROTOTYPE_METHOD(t, "mount",
Fuse::Mount);
NODE_SET_PROTOTYPE_METHOD(t, "umount",
Fuse::Umount);

t->SetClassName(String::NewSymbol("Fuse"));
target->Set(String::NewSymbol("Fuse"), t->GetFunction());
}

Fuse::Fuse() : ObjectWrap() {}
Fuse::~Fuse() {}

Handle<Value> Fuse::New(const Arguments& args) {
HandleScope scope;

Fuse *fuse = new Fuse();
Local<Object> obj = args.This();
fuse->Wrap(obj);

return obj;
}

Handle<Value> Fuse::Mount(const Arguments& args) {
HandleScope scope;
//handles parameters and mounts the filesystem
}

Handle<Value> Fuse::Umount(const Arguments& args) {
//umount file system
}
} //namespace NodeFuse

15 changes: 8 additions & 7 deletions src/node_fuse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
#include "bindings.h"

namespace NodeFuse {
void Initialize(Handle<Object> target) {
void InitializeFuse(Handle<Object> target) {
HandleScope scope;

Fuse::Initialize(target);
Session::Initialize(target);
Channel::Initialize(target);
Request::Initialize(target);
Reply::Initialize(target);

target->Set(String::NewSymbol("version"),
String::New(NODE_FUSE_VERSION));

Handle<ObjectTemplate> global = ObjectTemplate::New();
Handle<Context> context = Context::New(NULL, global);
Context::Scope context_scope(context);

context->Global()->Set(String::NewSymbol("Fuse"), target);
target->Set(String::NewSymbol("fuse_version"),
Integer::New(fuse_version()));
}

NODE_MODULE(fuse, Initialize)
NODE_MODULE(fuse, InitializeFuse)
} //namespace NodeFuse

2 changes: 1 addition & 1 deletion src/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def configure(conf):
os.putenv('PKG_CONFIG_PATH', '/usr/local/lib/pkgconfig')

conf.check_cfg(package='fuse', args='--cflags --libs')
conf.env.CPPFLAGS = ['-D_FILE_OFFSET_BITS=64', '-D__FreeBSD__=10', '-DFUSE_USE_VERSION=28']
conf.env.CPPFLAGS = ['-D_FILE_OFFSET_BITS=64', '-D__FreeBSD__=10', '-DFUSE_USE_VERSION=27']

def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
Expand Down

0 comments on commit 81fd286

Please sign in to comment.