XROAD
xroad_file.h File Reference
#include "xroad_string.h"
Include dependency graph for xroad_file.h:

Go to the source code of this file.

Classes

struct  xroad_file_rcallback_t
 
struct  xroad_file_wcallback_t
 

Macros

#define __xroad_file_dtor__   __dtor__(xroad_file_destructor)
 

Typedefs

typedef struct xroad_file_s xroad_file_t
 

Functions

xroad_file_t * xroad_file_create (xroad_str_t name, int32_t signal, int32_t flags, mode_t mode)
 
xroad_errno_t xroad_file_destroy (xroad_file_t *file)
 
void xroad_file_destructor (xroad_file_t **file)
 
int32_t xroad_file_cancel (xroad_file_t *file)
 
uint32_t xroad_file_get_req_cnt (xroad_file_t *file)
 
xroad_errno_t xroad_file_read (xroad_file_t *f, off_t offset, void *buf, size_t len, xroad_file_rcallback_t callback)
 
xroad_errno_t xroad_file_write (xroad_file_t *f, off_t offset, void *buf, size_t len, xroad_file_wcallback_t callback)
 

Detailed Description

Macro Definition Documentation

◆ __xroad_file_dtor__

#define __xroad_file_dtor__   __dtor__(xroad_file_destructor)

automatic destructor

Function Documentation

◆ xroad_file_cancel()

int32_t xroad_file_cancel ( xroad_file_t *  file)

cancel all async tasks

Parameters
[in]file- file instance
Returns
0 - all canceled, 1 - some tasks are still alive

◆ xroad_file_create()

xroad_file_t* xroad_file_create ( xroad_str_t  name,
int32_t  signal,
int32_t  flags,
mode_t  mode 
)

create file

Parameters
[in]name- file name (path)
[in]signal- real time signal from SIGRTMIN to SIGRTMAX, which will be sent after operation completion
[in]flags- open flags (man 2 open for details)
[in]mode- open mode (man 2 open for details)
Returns
file instance, NULL - in case of error

◆ xroad_file_destroy()

xroad_errno_t xroad_file_destroy ( xroad_file_t *  file)

file destroy

Parameters
[in]file- file to destroy
Returns
XROAD_OK - destroyed, XROAD_ERROR_BUSY - not destroyed, not all tasks are completed

◆ xroad_file_get_req_cnt()

uint32_t xroad_file_get_req_cnt ( xroad_file_t *  file)

return count of active tasks

Parameters
[in]file- file instance
Returns
count of active tasks

◆ xroad_file_read()

xroad_errno_t xroad_file_read ( xroad_file_t *  f,
off_t  offset,
void *  buf,
size_t  len,
xroad_file_rcallback_t  callback 
)

read file chunk

Parameters
[in]file- file instance to read
[in]offset- file read offset
[in]buf- preallocated buffer to store read data
[in]len- buffer length
[in]callback- read callback

◆ xroad_file_write()

xroad_errno_t xroad_file_write ( xroad_file_t *  f,
off_t  offset,
void *  buf,
size_t  len,
xroad_file_wcallback_t  callback 
)

write file chunk

Parameters
[in]file- file instance to read
[in]offset- file write offset
[in]buf- data to write
[in]len- data length
[in]callback- write callback