mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
added unit tests for open (adapter)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "webfuse/adapter/impl/filesystem.h"
|
||||
#include "webfuse/adapter/impl/operations.h"
|
||||
#include "webfuse/adapter/impl/operation/open.h"
|
||||
#include "webfuse/adapter/impl/session.h"
|
||||
#include "webfuse/adapter/impl/mountpoint.h"
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "webfuse/adapter/impl/operation/open.h"
|
||||
#include "webfuse/adapter/impl/operations.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <jansson.h>
|
||||
|
||||
#include "webfuse/core/jsonrpc/proxy.h"
|
||||
#include "webfuse/core/util.h"
|
||||
#include "webfuse/core/status.h"
|
||||
#include "webfuse/core/json_util.h"
|
||||
|
||||
static void wf_impl_operation_open_finished(
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
void wf_impl_operation_open_finished(
|
||||
void * user_data,
|
||||
json_t const * result,
|
||||
json_t const * error)
|
||||
|
||||
26
lib/webfuse/adapter/impl/operation/open.h
Normal file
26
lib/webfuse/adapter/impl/operation/open.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef WF_ADAPTER_IMPL_OPERATION_OPEN_H
|
||||
#define WF_ADAPTER_IMPL_OPERATION_OPEN_H
|
||||
|
||||
#include "webfuse/adapter/impl/fuse_wrapper.h"
|
||||
#include <jansson.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
extern void wf_impl_operation_open(
|
||||
fuse_req_t request,
|
||||
fuse_ino_t inode,
|
||||
struct fuse_file_info * file_info);
|
||||
|
||||
extern void wf_impl_operation_open_finished(
|
||||
void * user_data,
|
||||
json_t const * result,
|
||||
json_t const * error);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -34,11 +34,6 @@ extern void wf_impl_operation_readdir (
|
||||
off_t offset,
|
||||
struct fuse_file_info *file_info);
|
||||
|
||||
extern void wf_impl_operation_open(
|
||||
fuse_req_t request,
|
||||
fuse_ino_t inode,
|
||||
struct fuse_file_info * file_info);
|
||||
|
||||
extern void wf_impl_operation_close(
|
||||
fuse_req_t request,
|
||||
fuse_ino_t inode,
|
||||
|
||||
@@ -133,14 +133,13 @@ void wf_jsonrpc_proxy_cleanup(
|
||||
wf_timer_dispose(proxy->request.timer);
|
||||
}
|
||||
|
||||
void wf_jsonrpc_proxy_invoke(
|
||||
void wf_jsonrpc_proxy_vinvoke(
|
||||
struct wf_jsonrpc_proxy * proxy,
|
||||
wf_jsonrpc_proxy_finished_fn * finished,
|
||||
void * user_data,
|
||||
char const * method_name,
|
||||
char const * param_info,
|
||||
...
|
||||
)
|
||||
va_list args)
|
||||
{
|
||||
if (!proxy->request.is_pending)
|
||||
{
|
||||
@@ -150,10 +149,7 @@ void wf_jsonrpc_proxy_invoke(
|
||||
proxy->request.id = 42;
|
||||
wf_timer_start(proxy->request.timer, proxy->timeout);
|
||||
|
||||
va_list args;
|
||||
va_start(args, param_info);
|
||||
json_t * request = wf_jsonrpc_request_create(method_name, proxy->request.id, param_info, args);
|
||||
va_end(args);
|
||||
|
||||
bool const is_send = ((NULL != request) && (proxy->send(request, proxy->user_data)));
|
||||
if (!is_send)
|
||||
|
||||
@@ -41,6 +41,14 @@ extern void
|
||||
wf_jsonrpc_proxy_cleanup(
|
||||
struct wf_jsonrpc_proxy * proxy);
|
||||
|
||||
extern void wf_jsonrpc_proxy_vinvoke(
|
||||
struct wf_jsonrpc_proxy * proxy,
|
||||
wf_jsonrpc_proxy_finished_fn * finished,
|
||||
void * user_data,
|
||||
char const * method_name,
|
||||
char const * param_info,
|
||||
va_list args);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
15
lib/webfuse/core/jsonrpc/proxy_invoke.c
Normal file
15
lib/webfuse/core/jsonrpc/proxy_invoke.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "webfuse/core/jsonrpc/proxy_intern.h"
|
||||
|
||||
void wf_jsonrpc_proxy_invoke(
|
||||
struct wf_jsonrpc_proxy * proxy,
|
||||
wf_jsonrpc_proxy_finished_fn * finished,
|
||||
void * user_data,
|
||||
char const * method_name,
|
||||
char const * param_info,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, param_info);
|
||||
wf_jsonrpc_proxy_vinvoke(proxy, finished, user_data, method_name, param_info, args);
|
||||
va_end(args);
|
||||
}
|
||||
Reference in New Issue
Block a user