You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.4 KiB
48 lines
1.4 KiB
6 years ago
|
#include "wsfs/provider/impl/operation/open.h"
|
||
|
#include "wsfs/provider/impl/operation/error.h"
|
||
|
#include "wsfs/provider/impl/request.h"
|
||
|
#include "wsfs/core/util.h"
|
||
6 years ago
|
|
||
6 years ago
|
void wsfsp_impl_open(
|
||
|
struct wsfsp_impl_invokation_context * context,
|
||
6 years ago
|
json_t * params,
|
||
|
int id)
|
||
|
{
|
||
6 years ago
|
size_t const count = json_array_size(params);
|
||
|
if (2 == count)
|
||
|
{
|
||
|
json_t * inode_holder = json_array_get(params, 0);
|
||
|
json_t * flags_holder = json_array_get(params, 1);
|
||
6 years ago
|
|
||
6 years ago
|
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);
|
||
|
|
||
6 years ago
|
struct wsfsp_request * request = wsfsp_impl_request_create(context->request, id);
|
||
6 years ago
|
|
||
6 years ago
|
context->provider->open(request, inode, flags, context->user_data); /* Flawfinder: ignore */
|
||
6 years ago
|
}
|
||
|
}
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
void wsfsp_impl_open_default(
|
||
6 years ago
|
struct wsfsp_request * request,
|
||
6 years ago
|
ino_t WSFS_UNUSED_PARAM(inode),
|
||
|
int WSFS_UNUSED_PARAM(flags),
|
||
|
void * WSFS_UNUSED_PARAM(user_data))
|
||
6 years ago
|
{
|
||
6 years ago
|
wsfsp_impl_respond_error(request, WSFS_BAD_NOENTRY);
|
||
6 years ago
|
}
|
||
|
|
||
6 years ago
|
void wsfsp_impl_respond_open(
|
||
6 years ago
|
struct wsfsp_request * request,
|
||
|
uint32_t handle)
|
||
|
{
|
||
6 years ago
|
json_t * result = json_object();
|
||
|
json_object_set_new(result, "handle", json_integer((int) handle));
|
||
6 years ago
|
|
||
6 years ago
|
wsfsp_impl_respond(request, result);
|
||
6 years ago
|
}
|