2019-01-29 22:47:08 +00:00
|
|
|
#include "wsfs/operations.h"
|
|
|
|
|
|
|
|
#include <limits.h>
|
2019-02-03 18:10:05 +00:00
|
|
|
#include <errno.h>
|
2019-01-29 22:47:08 +00:00
|
|
|
#include <jansson.h>
|
2019-02-03 18:10:05 +00:00
|
|
|
|
2019-01-29 22:47:08 +00:00
|
|
|
#include "wsfs/jsonrpc.h"
|
2019-02-03 18:10:05 +00:00
|
|
|
#include "wsfs/util.h"
|
2019-01-29 22:47:08 +00:00
|
|
|
|
2019-02-03 18:10:05 +00:00
|
|
|
|
|
|
|
void wsfs_operation_close(
|
|
|
|
fuse_req_t request,
|
|
|
|
fuse_ino_t inode,
|
2019-01-29 22:47:08 +00:00
|
|
|
struct fuse_file_info * file_info)
|
|
|
|
{
|
2019-02-03 18:10:05 +00:00
|
|
|
struct wsfs_operations_context * user_data = fuse_req_userdata(request);
|
|
|
|
struct wsfs_jsonrpc * rpc = user_data->rpc;
|
2019-01-29 22:47:08 +00:00
|
|
|
|
|
|
|
json_t * result = NULL;
|
|
|
|
int handle = (int) (file_info->fh & INT_MAX);
|
2019-02-03 18:10:05 +00:00
|
|
|
wsfs_status const status = wsfs_jsonrpc_invoke(rpc, &result, "close", "iii", inode, handle, file_info->flags);
|
2019-01-29 22:47:08 +00:00
|
|
|
if (NULL != result)
|
|
|
|
{
|
|
|
|
// unused
|
|
|
|
json_decref(result);
|
|
|
|
}
|
|
|
|
|
2019-02-03 18:10:05 +00:00
|
|
|
|
|
|
|
fuse_reply_err(request, (WSFS_GOOD == status) ? 0 : ENOENT);
|
2019-01-29 22:47:08 +00:00
|
|
|
}
|