mirror of
https://github.com/fuse-friends/fuse-native
synced 2024-10-27 18:34:01 +00:00
bug fixes
This commit is contained in:
parent
2961856b5b
commit
73b897dfe7
@ -35,6 +35,11 @@
|
|||||||
blk\
|
blk\
|
||||||
uv_async_send(&(l->async));\
|
uv_async_send(&(l->async));\
|
||||||
uv_sem_wait(&(l->sem));\
|
uv_sem_wait(&(l->sem));\
|
||||||
|
if (l->ret != NULL) {\
|
||||||
|
void *tmp = l->ret;\
|
||||||
|
l->ret = NULL;\
|
||||||
|
return tmp;\
|
||||||
|
}\
|
||||||
return l->res;
|
return l->res;
|
||||||
|
|
||||||
#define FUSE_METHOD(name, callbackArgs, signalArgs, signature, callBlk, callbackBlk, signalBlk)\
|
#define FUSE_METHOD(name, callbackArgs, signalArgs, signature, callBlk, callbackBlk, signalBlk)\
|
||||||
@ -52,11 +57,9 @@
|
|||||||
NAPI_ARGV(signalArgs + 2)\
|
NAPI_ARGV(signalArgs + 2)\
|
||||||
NAPI_ARGV_BUFFER_CAST(fuse_thread_locals_t *, l, 0);\
|
NAPI_ARGV_BUFFER_CAST(fuse_thread_locals_t *, l, 0);\
|
||||||
NAPI_ARGV_INT32(res, 1);\
|
NAPI_ARGV_INT32(res, 1);\
|
||||||
int ret = NULL;\
|
|
||||||
signalBlk\
|
signalBlk\
|
||||||
l->res = ret ? ret : res;\
|
l->res = res;\
|
||||||
uv_sem_post(&(l->sem));\
|
uv_sem_post(&(l->sem));\
|
||||||
return ret;\
|
|
||||||
}\
|
}\
|
||||||
static int fuse_native_##name signature {\
|
static int fuse_native_##name signature {\
|
||||||
FUSE_NATIVE_HANDLER(name, callBlk)\
|
FUSE_NATIVE_HANDLER(name, callBlk)\
|
||||||
@ -140,6 +143,7 @@ typedef struct {
|
|||||||
gid_t gid;
|
gid_t gid;
|
||||||
uint32_t atim[2];
|
uint32_t atim[2];
|
||||||
uint32_t mtim[2];
|
uint32_t mtim[2];
|
||||||
|
void *ret;
|
||||||
int32_t res;
|
int32_t res;
|
||||||
|
|
||||||
// Extended attributes
|
// Extended attributes
|
||||||
@ -408,7 +412,7 @@ FUSE_METHOD(write, 5, 1, (const char *path, const char *buf, size_t len, off_t o
|
|||||||
// TODO: handle bytes processed?
|
// TODO: handle bytes processed?
|
||||||
})
|
})
|
||||||
|
|
||||||
FUSE_METHOD(readdir, 1, 1, (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *info), {
|
FUSE_METHOD(readdir, 1, 2, (const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *info), {
|
||||||
l->buf = buf;
|
l->buf = buf;
|
||||||
l->path = path;
|
l->path = path;
|
||||||
l->offset = offset;
|
l->offset = offset;
|
||||||
@ -548,7 +552,7 @@ FUSE_METHOD(removexattr, 2, 0, (const char *path, const char *name), {
|
|||||||
FUSE_METHOD(init, 0, 0, (struct fuse_conn_info *conn, struct fuse_config *cfg), {
|
FUSE_METHOD(init, 0, 0, (struct fuse_conn_info *conn, struct fuse_config *cfg), {
|
||||||
}, {
|
}, {
|
||||||
}, {
|
}, {
|
||||||
ret = (int) l->fuse;
|
l->ret = (int) l->fuse;
|
||||||
})
|
})
|
||||||
|
|
||||||
FUSE_METHOD(error, 0, 0, (), {}, {}, {})
|
FUSE_METHOD(error, 0, 0, (), {}, {}, {})
|
||||||
@ -631,7 +635,6 @@ FUSE_METHOD(readlink, 1, 1, (const char *path, char *linkname, size_t len), {
|
|||||||
}, {
|
}, {
|
||||||
NAPI_ARGV_UTF8(linkname, l->len, 2)
|
NAPI_ARGV_UTF8(linkname, l->len, 2)
|
||||||
strncpy(l->linkname, linkname, l->len);
|
strncpy(l->linkname, linkname, l->len);
|
||||||
ret = 0;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
FUSE_METHOD(chown, 3, 0, (const char *path, uid_t uid, gid_t gid), {
|
FUSE_METHOD(chown, 3, 0, (const char *path, uid_t uid, gid_t gid), {
|
||||||
|
8
index.js
8
index.js
@ -43,7 +43,8 @@ const OpcodesAndDefaults = new Map([
|
|||||||
op: binding.op_fsyncdir
|
op: binding.op_fsyncdir
|
||||||
}],
|
}],
|
||||||
['readdir', {
|
['readdir', {
|
||||||
op: binding.op_readdir
|
op: binding.op_readdir,
|
||||||
|
defaults: [[], []]
|
||||||
}],
|
}],
|
||||||
['truncate', {
|
['truncate', {
|
||||||
op: binding.op_truncate
|
op: binding.op_truncate
|
||||||
@ -102,7 +103,8 @@ const OpcodesAndDefaults = new Map([
|
|||||||
op: binding.op_releasedir
|
op: binding.op_releasedir
|
||||||
}],
|
}],
|
||||||
['create', {
|
['create', {
|
||||||
op: binding.op_create
|
op: binding.op_create,
|
||||||
|
defaults: [0]
|
||||||
}],
|
}],
|
||||||
['unlink', {
|
['unlink', {
|
||||||
op: binding.op_unlink
|
op: binding.op_unlink
|
||||||
@ -216,7 +218,7 @@ class Fuse extends Nanoresource {
|
|||||||
function signal (nativeHandler, err, ...args) {
|
function signal (nativeHandler, err, ...args) {
|
||||||
const arr = [nativeHandler, err, ...args]
|
const arr = [nativeHandler, err, ...args]
|
||||||
if (defaults && (!args || !args.length)) arr.concat(defaults)
|
if (defaults && (!args || !args.length)) arr.concat(defaults)
|
||||||
return nativeSignal(...arr)
|
return process.nextTick(nativeSignal, ...arr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user