Permalink
Browse files

[mount] Add `umount` function

  • Loading branch information...
mmalecki committed Oct 30, 2011
1 parent 3350797 commit 955f362edbacd02d01e145c0a1c0b9e03a211706
Showing with 13 additions and 0 deletions.
  1. +13 −0 src/mount.cc
View
@@ -18,8 +18,21 @@ v8::Handle<v8::Value> Mount(const v8::Arguments &args) {
return (mount(*device, *path, *type, 0, NULL) == 0) ? v8::True() : v8::False();
}
+v8::Handle<v8::Value> Umount(const v8::Arguments &args) {
+ v8::HandleScope scope;
+
+ if (args.Length() < 1) {
+ return v8::ThrowException(v8::String::New("`umount` needs at least 1 parameter"));
+ }
+
+ v8::String::Utf8Value path(args[0]->ToString());
+
+ return (umount(*path) == 0) ? v8::True() : v8::False();
+}
+
void init (v8::Handle<v8::Object> target) {
NODE_SET_METHOD(target, "mount", Mount);
+ NODE_SET_METHOD(target, "umount", Umount);
}
NODE_MODULE(mount, init)

0 comments on commit 955f362

Please sign in to comment.