mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
refactor: merged code structure
This commit is contained in:
46
include/webfuse_provider/operation/close.h
Normal file
46
include/webfuse_provider/operation/close.h
Normal file
@@ -0,0 +1,46 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/close.h
|
||||
/// \brief Provider's close callback.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_CLOSE_H
|
||||
#define WFP_OPERATION_CLOSE_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#include <cinttypes>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Callback invoked when a file is invoked.
|
||||
///
|
||||
/// This function does not respond.
|
||||
///
|
||||
/// \param inode inode of file to close
|
||||
/// \param handle handle of file to close
|
||||
/// \param flags file close flags
|
||||
/// \param user_data user defined context
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_close_fn(
|
||||
ino_t inode,
|
||||
uint32_t handle,
|
||||
int flags,
|
||||
void * user_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
36
include/webfuse_provider/operation/error.h
Normal file
36
include/webfuse_provider/operation/error.h
Normal file
@@ -0,0 +1,36 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/error.h
|
||||
/// \brief Respond with error code.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_ERROR_H
|
||||
#define WFP_OPERATION_ERROR_H
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
#include "webfuse_provider/status.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to a request with an error.
|
||||
///
|
||||
/// A client's callback must respond with exactly one responde, either with a
|
||||
/// valid reponse regarding to the concrete request or with an error response.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param status error code
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_error(
|
||||
struct wfp_request * request,
|
||||
wf_status status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
55
include/webfuse_provider/operation/getattr.h
Normal file
55
include/webfuse_provider/operation/getattr.h
Normal file
@@ -0,0 +1,55 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/getattr.h
|
||||
/// \brief Get file attributes.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_GETATTR_H
|
||||
#define WFP_OPERATION_GETATTR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Get file attributes.
|
||||
///
|
||||
/// \note After this function is called, exactly one response must be sent,
|
||||
/// either via \ref wfp_respond_getattr or via \ref wfp_respond_error.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param inode inode of file to get attributes
|
||||
/// \param user_data user defined context
|
||||
///
|
||||
/// \see wfp_respond_getattr
|
||||
/// \see wfp_respond_error
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_getattr_fn(
|
||||
struct wfp_request * request,
|
||||
ino_t inode,
|
||||
void * user_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to a get attributes request.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param stat file attributes
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_getattr(
|
||||
struct wfp_request * request,
|
||||
struct stat const * stat);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
57
include/webfuse_provider/operation/lookup.h
Normal file
57
include/webfuse_provider/operation/lookup.h
Normal file
@@ -0,0 +1,57 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/lookup.h
|
||||
/// \brief Lookup file.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_LOOKUP_H
|
||||
#define WFP_OPERATION_LOOKUP_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Lookup a file or directory.
|
||||
///
|
||||
/// \note After this function is called, exactly one response must be sent,
|
||||
/// either via \ref wfp_respond_lookup or via \ref wfp_respond_error.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param parent inode of parent
|
||||
/// \param name name of the filesystem object to lookup
|
||||
/// \param user_data pointer to user defined context
|
||||
///
|
||||
/// \see wfp_respond_lookup
|
||||
/// \see wfp_respond_error
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_lookup_fn(
|
||||
struct wfp_request * request,
|
||||
ino_t parent,
|
||||
char const * name,
|
||||
void * user_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to lookup request.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param stat attributes of filesystem object
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_lookup(
|
||||
struct wfp_request * request,
|
||||
struct stat const * stat);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
63
include/webfuse_provider/operation/open.h
Normal file
63
include/webfuse_provider/operation/open.h
Normal file
@@ -0,0 +1,63 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/open.h
|
||||
/// \brief Open a file.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_OPEN_H
|
||||
#define WFP_OPERATION_OPEN_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#include <cinttypes>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Open a file.
|
||||
///
|
||||
/// \note After this function is called, exactly one response must be sent,
|
||||
/// either via \ref wfp_respond_open or via \ref wfp_respond_error.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param inode inode of the file to open
|
||||
/// \param flags file open flags
|
||||
/// \param user_data user defined context
|
||||
///
|
||||
/// \see wfp_respond_open
|
||||
/// \see wfp_respond_error
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_open_fn(
|
||||
struct wfp_request * request,
|
||||
ino_t inode,
|
||||
int flags,
|
||||
void * user_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to open file.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param handle handle of the opened file
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_open(
|
||||
struct wfp_request * request,
|
||||
uint32_t handle);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
include/webfuse_provider/operation/read.h
Normal file
76
include/webfuse_provider/operation/read.h
Normal file
@@ -0,0 +1,76 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/read.h
|
||||
/// \brief Read contents of a file.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_READ_H
|
||||
#define WFP_OPERATION_READ_H
|
||||
|
||||
#ifndef __cplusplus
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
#else
|
||||
#include <cstddef>
|
||||
#include <cinttypes>
|
||||
using std::size_t;
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Requests content of a file.
|
||||
///
|
||||
/// On success, up to \arg length bytes should be returned via \ref
|
||||
/// wfp_respond_read.
|
||||
///
|
||||
/// \note After this function is called, exactly one response must be sent,
|
||||
/// either via \ref wfp_respond_read or via \ref wfp_respond_error.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param inode inode of the file to read
|
||||
/// \param handle handle of the file to read (returned by open)
|
||||
/// \param offset offset within the file where to start reading
|
||||
/// \param length amount of bytes to read
|
||||
/// \param user_data used defined context
|
||||
///
|
||||
/// \see wfp_respond_read
|
||||
/// \see wfp_respond_error
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_read_fn(
|
||||
struct wfp_request * request,
|
||||
ino_t inode,
|
||||
uint32_t handle,
|
||||
size_t offset,
|
||||
size_t length,
|
||||
void * user_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to read.
|
||||
///
|
||||
/// \note The user is responsible to manage lifetime of \arg data.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param data data read from file
|
||||
/// \param length amount of bytes read
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_read(
|
||||
struct wfp_request * request,
|
||||
char const * data,
|
||||
size_t length);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
58
include/webfuse_provider/operation/readdir.h
Normal file
58
include/webfuse_provider/operation/readdir.h
Normal file
@@ -0,0 +1,58 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// \file provider/operation/readdir.h
|
||||
/// \brief List directory contents.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef WFP_OPERATION_READDIR_H
|
||||
#define WFP_OPERATION_READDIR_H
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "webfuse_provider/api.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
struct wfp_dirbuffer;
|
||||
struct wfp_request;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Requests the contents of a directory.
|
||||
///
|
||||
/// \note After this function is called, exactly one response must be sent,
|
||||
/// either via \ref wfp_respond_readdir or via \ref wfp_respond_error.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param directory inode of directory to list
|
||||
/// \param user_data user defined context
|
||||
///
|
||||
/// \see wfp_respond_readdir
|
||||
/// \see wfp_respond_error
|
||||
//------------------------------------------------------------------------------
|
||||
typedef void wfp_readdir_fn(
|
||||
struct wfp_request * request,
|
||||
ino_t directory,
|
||||
void * user_data);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \brief Respond to list directory contents.
|
||||
///
|
||||
/// \note The user is responsible to manage dirbuffe, p.e. to dispose
|
||||
/// it after this function is called.
|
||||
///
|
||||
/// \param request pointer to request
|
||||
/// \param dirbuffer contains contents of directory
|
||||
//------------------------------------------------------------------------------
|
||||
extern WFP_API void wfp_respond_readdir(
|
||||
struct wfp_request * request,
|
||||
struct wfp_dirbuffer * dirbuffer);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user