Manipulate an Eina_File asynchronously

- Main Page
- Related Pages
- Modules
- Data Structures
- Files
- Examples

Functions
Manipulate an Eina_File asynchronously
Eio

This function helps when manipulating a file asynchronously. More...

## Functions
EIO_API Eio_File * | eio_file_open (const char *name, Eina_Bool shared, Eio_Open_Cb open_cb, Eio_Error_Cb error_cb, const void *data)
| Asynchronously open a file.
EIO_API Eio_File * | eio_file_close (Eina_File *f, Eio_Done_Cb done_cb, Eio_Error_Cb error_cb, const void *data)
| Asynchronously close a file.
EIO_API Eio_File * | eio_file_map_all (Eina_File *f, Eina_File_Populate rule, Eio_Filter_Map_Cb filter_cb, Eio_Map_Cb map_cb, Eio_Error_Cb error_cb, const void *data)
| Asynchronously map a file in memory.
EIO_API Eio_File * | eio_file_map_new (Eina_File *f, Eina_File_Populate rule, unsigned long int offset, unsigned long int length, Eio_Filter_Map_Cb filter_cb, Eio_Map_Cb map_cb, Eio_Error_Cb error_cb, const void *data)
| Asynchronously map a part of a file in memory.

## Detailed Description

This function helps when manipulating a file asynchronously.

These set of functions work on top of Eina_File and Ecore_Thread to do basic operations on a file, like opening, closing and mapping a file to memory.

## Function Documentation

## ◆ eio_file_open()

EIO_API Eio_File * eio_file_open | ( | const char * | name,
|  | Eina_Bool | shared,
|  | Eio_Open_Cb | open_cb,
|  | Eio_Error_Cb | error_cb,
|  | const void * | data
| ) |  |

Asynchronously open a file.

Parameters

  name | The file to open.
  shared | If it's a shared memory file.
  open_cb | Callback called in the main loop when the file has been successfully opened.
  error_cb | Callback called in the main loop when the file couldn't be opened.
  data | Unmodified user data passed to callbacks

Returns
  Pointer to the file if successful or NULL otherwise.

References EINA_SAFETY_ON_NULL_RETURN_VAL, and eina_stringshare_add().

## ◆ eio_file_close()

EIO_API Eio_File * eio_file_close | ( | Eina_File * | f,
|  | Eio_Done_Cb | done_cb,
|  | Eio_Error_Cb | error_cb,
|  | const void * | data
| ) |  |

Asynchronously close a file.

Parameters

  f | The file to close.
  done_cb | Callback called in the main loop when the file has been successfully closed.
  error_cb | Callback called in the main loop when the file couldn't be closed.
  data | Unmodified user data passed to callbacks

Returns
  Pointer to the file if successful or NULL otherwise.

References EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eio_file_map_all()

EIO_API Eio_File * eio_file_map_all | ( | Eina_File * | f,
|  | Eina_File_Populate | rule,
|  | Eio_Filter_Map_Cb | filter_cb,
|  | Eio_Map_Cb | map_cb,
|  | Eio_Error_Cb | error_cb,
|  | const void * | data
| ) |  |

Asynchronously map a file in memory.

Parameters

  f | The file to map.
  rule | The rule to apply to the map.
  filter_cb | Callback called in the thread to validate the content of the map.
  map_cb | Callback called in the main loop when the file has been successfully mapped.
  error_cb | Callback called in the main loop when the file can't be mapped.
  data | Unmodified user data passed to callbacks

Returns
  Pointer to the file if successful or NULL otherwise.

The container of the Eio_File is the Eina_File.

References eina_file_size_get(), and EINA_SAFETY_ON_NULL_RETURN_VAL.

## ◆ eio_file_map_new()

EIO_API Eio_File * eio_file_map_new | ( | Eina_File * | f,
|  | Eina_File_Populate | rule,
|  | unsigned long int | offset,
|  | unsigned long int | length,
|  | Eio_Filter_Map_Cb | filter_cb,
|  | Eio_Map_Cb | map_cb,
|  | Eio_Error_Cb | error_cb,
|  | const void * | data
| ) |  |

Asynchronously map a part of a file in memory.

Parameters

  f | The file to map.
  rule | The rule to apply to the map.
  offset | The offset inside the file
  length | The length of the memory to map
  filter_cb | Callback called in the thread to validate the content of the map.
  map_cb | Callback called in the main loop when the file has been successfully mapped.
  error_cb | Callback called in the main loop when the file can't be mapped.
  data | Unmodified user data passed to callbacks

Returns
  Pointer to the file if successful or NULL otherwise.

The container of the Eio_File is the Eina_File.

References EINA_SAFETY_ON_NULL_RETURN_VAL.