Skip to content
This repository was archived by the owner on Jan 29, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
"devDependencies": {
"eslint": "^3.19.0",
"file-disk": "^5.0.0",
"mocha": "^2.2.5"
"mocha": "^2.2.5",
"node-gyp": "^6.1.0"
},
"dependencies": {
"async": "^2.1.5",
"bindings": "^1.2.1",
"bindings": "^1.5.0",
"bluebird": "^3.5.3",
"nan": "^2.5.1"
"nan": "^2.14.0"
}
}
10 changes: 6 additions & 4 deletions src/async.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ static NAN_METHOD(callback_wrapper) {
if ((async == NULL) || (uv_is_closing((uv_handle_t*)async) != 0)) {
return;
}
auto data = info.Data()->ToObject();
auto context = info.GetIsolate()->GetCurrentContext();
auto data = info.Data()->ToObject(context).ToLocalChecked();

void (*fn)(NAN_METHOD_ARGS_TYPE, void *) = data->Get(0).As<v8::External>()->Value();
void (*fn)(NAN_METHOD_ARGS_TYPE, void *) = Get(data, (uint32_t)0).ToLocalChecked().As<v8::External>()->Value();
auto args = data->Get(1).As<v8::External>()->Value();

if (fn && args) {
Expand All @@ -65,9 +66,10 @@ static NAN_METHOD(callback_wrapper) {
}

v8::Local<v8::Function> make_callback(void (*fn)(NAN_METHOD_ARGS_TYPE, void *), void *args) {
auto data = New<v8::Object>();
auto context = GetCurrentContext();
auto data = New<v8::Object>();
data->Set(0, New<v8::External>(fn));
data->Set(1, New<v8::External>(args));

return New<v8::FunctionTemplate>(callback_wrapper, data)->GetFunction();
return New<v8::FunctionTemplate>(callback_wrapper, data)->GetFunction(context).ToLocalChecked();
}
23 changes: 14 additions & 9 deletions src/disk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@ struct request_state_t {
};

static void get_capacity_done(NAN_METHOD_ARGS_TYPE info, get_capacity_state_t* s) {
auto context = info.GetIsolate()->GetCurrentContext();
if (info[0]->IsNull()) {
s->ret = 0;
*(s->res) = info[1]->IntegerValue();
*(s->res) = info[1]->IntegerValue(context).ToChecked();
} else {
s->ret = info[0]->IntegerValue();
s->ret = info[0]->IntegerValue(context).ToChecked();
*(s->res) = 0;
}

Expand All @@ -83,7 +84,8 @@ static void request_done(NAN_METHOD_ARGS_TYPE info, request_state_t* s) {
if (info[0]->IsNull()) {
s->ret = 0;
} else {
s->ret = info[0]->IntegerValue();
auto context = info.GetIsolate()->GetCurrentContext();
s->ret = info[0]->IntegerValue(context).ToChecked();
}

// Unblocks the original lkl thread
Expand Down Expand Up @@ -228,7 +230,8 @@ void do_disk_remove(disk_remove_args_t *args) {

NAN_METHOD(disk_remove) {
CHECK_ARGS(2);
unsigned int disk_id = info[0]->Uint32Value();
auto context = info.GetIsolate()->GetCurrentContext();
unsigned int disk_id = info[0]->Uint32Value(context).ToChecked();
Callback *callback = new Callback(info[1].As<v8::Function>());
disk_remove_args_t *args = new disk_remove_args_t;
args->disk_id = disk_id;
Expand Down Expand Up @@ -283,15 +286,16 @@ void do_mount(mount_args_t* args) {

NAN_METHOD(mount) {
CHECK_ARGS(5);
unsigned int disk_id = info[0]->Uint32Value();
bool readonly = info[1]->BooleanValue();
auto context = info.GetIsolate()->GetCurrentContext();
unsigned int disk_id = info[0]->Uint32Value(context).ToChecked();
bool readonly = info[1]->BooleanValue(context).ToChecked();

char *fs_type = new char[10];
Utf8String fs_type_(info[2]);
strncpy(fs_type, *fs_type_, sizeof(fs_type) - 1);
fs_type[sizeof(fs_type) - 1] = '\0';

unsigned int part = info[3]->Uint32Value();
unsigned int part = info[3]->Uint32Value(context).ToChecked();

Callback *callback = new Callback(info[4].As<v8::Function>());

Expand Down Expand Up @@ -338,8 +342,9 @@ void do_umount(umount_args_t* args) {

NAN_METHOD(umount) {
CHECK_ARGS(3);
unsigned int disk_id = info[0]->Uint32Value();
unsigned int partition = info[1]->Uint32Value();
auto context = info.GetIsolate()->GetCurrentContext();
unsigned int disk_id = info[0]->Uint32Value(context).ToChecked();
unsigned int partition = info[1]->Uint32Value(context).ToChecked();
Callback *callback = new Callback(info[2].As<v8::Function>());
umount_args_t* args = new umount_args_t;
args->disk_id = disk_id;
Expand Down
11 changes: 7 additions & 4 deletions src/node_lkl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ NAN_METHOD(startKernel) {
}

lkl_host_ops.print = NULL;
int memory = info[0]->Uint32Value();
auto context = info.GetIsolate()->GetCurrentContext();
int memory = info[0]->Uint32Value(context).ToChecked();
init_async();
init_worker();
lkl_start_kernel(&lkl_host_ops, memory, "");
Expand Down Expand Up @@ -69,7 +70,8 @@ void do_syscall(syscall_args_t* args) {
}

void syscall_entry(NAN_METHOD_ARGS_TYPE info) {
long no = info[0]->IntegerValue();
auto context = info.GetIsolate()->GetCurrentContext();
long no = info[0]->IntegerValue(context).ToChecked();
long *params = new long[6];
std::vector<char*> *paths = new std::vector<char*>();

Expand All @@ -84,7 +86,7 @@ void syscall_entry(NAN_METHOD_ARGS_TYPE info) {
params[i] = p;
paths->push_back(p);
} else {
params[i] = info[i + 1]->IntegerValue();
params[i] = info[i + 1]->IntegerValue(context).ToChecked();
}
}
Callback *callback = new Callback(info[7].As<v8::Function>());
Expand Down Expand Up @@ -198,8 +200,9 @@ NAN_METHOD(parseLklStat) {
}

NAN_METHOD(millisecondsToTimespec) {
auto context = info.GetIsolate()->GetCurrentContext();
auto *ts = new struct timespec;
auto milliseconds = info[0]->IntegerValue();
auto milliseconds = info[0]->IntegerValue(context).ToChecked();
ts->tv_sec = milliseconds / 1000;
ts->tv_nsec = (milliseconds % 1000) * 1000000;
auto result = Nan::NewBuffer(
Expand Down