1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

remove debugging messages

This commit is contained in:
Andrew Osheroff 2019-08-02 11:01:23 +02:00
parent 54a5d6c0b3
commit 97e42d4fb9
2 changed files with 0 additions and 32 deletions

View File

@ -18,32 +18,22 @@
#include <pthread.h> #include <pthread.h>
#define FUSE_NATIVE_CALLBACK(fn, blk)\ #define FUSE_NATIVE_CALLBACK(fn, blk)\
printf("in fuse_native_callback, ft: %zu\n", ft); \
napi_env env = ft->env;\ napi_env env = ft->env;\
printf("0\n");\
napi_handle_scope scope;\ napi_handle_scope scope;\
printf("1\n");\
napi_open_handle_scope(env, &scope);\ napi_open_handle_scope(env, &scope);\
printf("2\n");\
napi_value ctx;\ napi_value ctx;\
printf("3\n");\
napi_get_reference_value(env, ft->ctx, &ctx);\ napi_get_reference_value(env, ft->ctx, &ctx);\
printf("4\n");\
napi_value callback;\ napi_value callback;\
napi_get_reference_value(env, fn, &callback);\ napi_get_reference_value(env, fn, &callback);\
printf("in fuse_native_callback, entering blk\n");\
blk\ blk\
printf("in fuse_native_callback, exiting blk\n");\
napi_close_handle_scope(env, scope); napi_close_handle_scope(env, scope);
#define FUSE_NATIVE_HANDLER(name, blk)\ #define FUSE_NATIVE_HANDLER(name, blk)\
struct fuse_context *ctx = fuse_get_context();\ struct fuse_context *ctx = fuse_get_context();\
fuse_thread_t *ft = (fuse_thread_t *) ctx->private_data;\ fuse_thread_t *ft = (fuse_thread_t *) ctx->private_data;\
fuse_thread_locals_t *l = get_thread_locals();\ fuse_thread_locals_t *l = get_thread_locals();\
printf("1, in fuse_native_handler in thread: %d, l->fuse: %zu, ft: %zu\n", pthread_self(), l->fuse, ft); \
l->fuse = ft;\ l->fuse = ft;\
l->op = op_##name;\ l->op = op_##name;\
printf("2, in fuse_native_handler in thread: %d, l->fuse: %zu\n", pthread_self(), l->fuse); \
blk\ blk\
uv_async_send(&(l->async));\ uv_async_send(&(l->async));\
fuse_native_semaphore_wait(&(l->sem));\ fuse_native_semaphore_wait(&(l->sem));\
@ -51,16 +41,12 @@ printf("4\n");\
#define FUSE_METHOD(name, callbackArgs, signalArgs, signature, callBlk, callbackBlk, signalBlk)\ #define FUSE_METHOD(name, callbackArgs, signalArgs, signature, callBlk, callbackBlk, signalBlk)\
static void fuse_native_dispatch_##name (uv_async_t* handle, int status, fuse_thread_locals_t* l, fuse_thread_t* ft) {\ static void fuse_native_dispatch_##name (uv_async_t* handle, int status, fuse_thread_locals_t* l, fuse_thread_t* ft) {\
printf("at beginning of fuse_native_dispatch_%s\n", #name);\
uint32_t op = op_##name;\ uint32_t op = op_##name;\
printf("op here: %i\n", op);\
printf("in fuse_native_dispatch, op: %i\n", op); \
FUSE_NATIVE_CALLBACK(ft->handlers[op], {\ FUSE_NATIVE_CALLBACK(ft->handlers[op], {\
napi_value argv[callbackArgs + 2];\ napi_value argv[callbackArgs + 2];\
napi_create_external_buffer(env, sizeof(fuse_thread_locals_t), l, &fin, NULL, &(argv[0]));\ napi_create_external_buffer(env, sizeof(fuse_thread_locals_t), l, &fin, NULL, &(argv[0]));\
napi_create_uint32(env, l->op, &(argv[1]));\ napi_create_uint32(env, l->op, &(argv[1]));\
callbackBlk\ callbackBlk\
printf("in fuse_native_callback, calling callback for %s\n", #name);\
NAPI_MAKE_CALLBACK(env, NULL, ctx, callback, callbackArgs + 2, argv, NULL)\ NAPI_MAKE_CALLBACK(env, NULL, ctx, callback, callbackArgs + 2, argv, NULL)\
})\ })\
}\ }\
@ -71,13 +57,10 @@ printf("4\n");\
int ret = NULL;\ int ret = NULL;\
signalBlk\ signalBlk\
l->res = ret ? ret : res;\ l->res = ret ? ret : res;\
printf("in _fuse_native_signal_%s, signalling semaphore\n", #name);\
fuse_native_semaphore_signal(&(l->sem));\ fuse_native_semaphore_signal(&(l->sem));\
printf("fuse_native_signal_%s returning %zu\n", #name, ret);\
return ret;\ return ret;\
}\ }\
static int fuse_native_##name signature {\ static int fuse_native_##name signature {\
printf("in fuse_native_%s\n", #name);\
FUSE_NATIVE_HANDLER(name, callBlk)\ FUSE_NATIVE_HANDLER(name, callBlk)\
} }
@ -256,11 +239,8 @@ FUSE_METHOD(getattr, 1, 1, (const char *path, struct stat *stat, struct fuse_fil
napi_create_string_utf8(env, l->path, NAPI_AUTO_LENGTH, &(argv[2])); napi_create_string_utf8(env, l->path, NAPI_AUTO_LENGTH, &(argv[2]));
}, },
{ {
printf("right before getattr buffer cast\n");
NAPI_ARGV_BUFFER_CAST(uint32_t*, ints, 2) NAPI_ARGV_BUFFER_CAST(uint32_t*, ints, 2)
printf("populating stat\n");
populate_stat(ints, l->stat); populate_stat(ints, l->stat);
printf("populated stat\n");
}) })
FUSE_METHOD(fgetattr, 2, 1, (const char *path, struct stat *stat, struct fuse_file_info *info), { FUSE_METHOD(fgetattr, 2, 1, (const char *path, struct stat *stat, struct fuse_file_info *info), {
@ -563,11 +543,8 @@ 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), {
printf("in fuse_native_init\n");
}, { }, {
printf("in fuse_native_init_callback\n");
}, { }, {
printf("in fuse_native_signal_init, l->fuse: %zu\n", l->fuse);
ret = (int) l->fuse; ret = (int) l->fuse;
}) })
@ -649,11 +626,8 @@ FUSE_METHOD(readlink, 1, 1, (const char *path, char *linkname, size_t len), {
}, { }, {
napi_create_string_utf8(env, l->path, NAPI_AUTO_LENGTH, &(argv[2])); napi_create_string_utf8(env, l->path, NAPI_AUTO_LENGTH, &(argv[2]));
}, { }, {
printf("right before napi_argv_utf8\n");
NAPI_ARGV_UTF8(linkname, l->len, 2) NAPI_ARGV_UTF8(linkname, l->len, 2)
printf("right after napi_argv_utf8, len: %i, linkname: %s \n", l->len, linkname);
strncpy(l->linkname, linkname, l->len); strncpy(l->linkname, linkname, l->len);
printf("after copy: l->linkname: %s\n", l->linkname);
ret = 0; ret = 0;
}) })
@ -749,8 +723,6 @@ static void fuse_native_dispatch (uv_async_t* handle, int status) {
fuse_thread_locals_t *l = (fuse_thread_locals_t *) handle->data; fuse_thread_locals_t *l = (fuse_thread_locals_t *) handle->data;
fuse_thread_t *ft = l->fuse; fuse_thread_t *ft = l->fuse;
printf("dispatching %i, ft here: %zu\n", l->op, ft);
// TODO: Either use a function pointer (like ft->handlers[op]) or generate with a macro. // TODO: Either use a function pointer (like ft->handlers[op]) or generate with a macro.
switch (l->op) { switch (l->op) {
case (op_init): return fuse_native_dispatch_init(handle, status, l, ft); case (op_init): return fuse_native_dispatch_init(handle, status, l, ft);

View File

@ -223,10 +223,8 @@ class Fuse {
} }
function signal (nativeHandler, err, ...args) { function signal (nativeHandler, err, ...args) {
console.log('nativeHanlder:', nativeHandler, 'err:', err, 'args:', 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)
console.log('signalling with arr:', arr)
return nativeSignal(...arr) return nativeSignal(...arr)
} }
} }
@ -270,7 +268,6 @@ class Fuse {
return return
} }
this.ops.getattr(path, (err, stat) => { this.ops.getattr(path, (err, stat) => {
console.log('USER GETATT RESULT, path:', path, 'err:', err, 'stat:', stat)
if (err) return signal(err, getStatArray()) if (err) return signal(err, getStatArray())
return signal(0, getStatArray(stat)) return signal(0, getStatArray(stat))
}) })
@ -479,7 +476,6 @@ class Fuse {
mount (cb) { mount (cb) {
const opts = this._fuseOptions() const opts = this._fuseOptions()
console.log('mounting at %s with opts: %s', this.mnt, opts)
const implemented = this._getImplementedArray() const implemented = this._getImplementedArray()
fs.stat(this.mnt, (err, stat) => { fs.stat(this.mnt, (err, stat) => {
if (err) return cb(new Error('Mountpoint does not exist')) if (err) return cb(new Error('Mountpoint does not exist'))