mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
fa78e23533
* added API stub of static_filesystem * added callback functions * added basic directory listing * resize filesystem if necessary * added path stub * adds imlementation and tests of path * adds mock of wpf_request * adds test implementation and some matchers * added matcher of readdir results * fixes default directory test * adds implementation of static_filesystem_add and add_text * added implementation of read * adds implementation of filesystem_read * corrects naming of some functions * removes Flawfinder comments, since Flawfinder is disabled
48 lines
1.3 KiB
C
48 lines
1.3 KiB
C
#include "webfuse/provider/impl/operation/open.h"
|
|
#include "webfuse/provider/impl/operation/error.h"
|
|
#include "webfuse/provider/impl/request.h"
|
|
#include "webfuse/core/util.h"
|
|
|
|
void wfp_impl_open(
|
|
struct wfp_impl_invokation_context * context,
|
|
json_t * params,
|
|
int id)
|
|
{
|
|
size_t const count = json_array_size(params);
|
|
if (3 == count)
|
|
{
|
|
json_t * inode_holder = json_array_get(params, 1);
|
|
json_t * flags_holder = json_array_get(params, 2);
|
|
|
|
if (json_is_integer(inode_holder) &&
|
|
json_is_integer(flags_holder))
|
|
{
|
|
ino_t inode = (ino_t) json_integer_value(inode_holder);
|
|
int flags = (ino_t) json_integer_value(flags_holder);
|
|
|
|
struct wfp_request * request = wfp_impl_request_create(context->request, id);
|
|
|
|
context->provider->open(request, inode, flags, context->user_data);
|
|
}
|
|
}
|
|
}
|
|
|
|
void wfp_impl_open_default(
|
|
struct wfp_request * request,
|
|
ino_t WF_UNUSED_PARAM(inode),
|
|
int WF_UNUSED_PARAM(flags),
|
|
void * WF_UNUSED_PARAM(user_data))
|
|
{
|
|
wfp_impl_respond_error(request, WF_BAD_NOENTRY);
|
|
}
|
|
|
|
void wfp_impl_respond_open(
|
|
struct wfp_request * request,
|
|
uint32_t handle)
|
|
{
|
|
json_t * result = json_object();
|
|
json_object_set_new(result, "handle", json_integer((int) handle));
|
|
|
|
wfp_impl_respond(request, result);
|
|
}
|