2013-05-16 06:34:03 -07:00
/* EIO - Core asynchronous input/output operation library.
2010-07-22 09:08:17 -07:00
* Copyright ( C ) 2010 Enlightenment Developers :
* Cedric Bail < cedric . bail @ free . fr >
2013-05-16 06:34:03 -07:00
* Gustavo Sverzut Barbieri < barbieri @ gmail . com >
2010-07-22 09:08:17 -07:00
* Vincent " caro " Torri < vtorri at univ - evry dot fr >
2013-05-16 17:33:22 -07:00
* Stephen " okra " Houston < unixtitan @ gmail . com >
* Guillaume " kuri " Friloux < guillaume . friloux @ asp64 . com >
2010-07-22 09:08:17 -07:00
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library ;
* if not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef EIO_H__
# define EIO_H__
2010-08-31 09:24:58 -07:00
# include <sys/types.h>
# include <sys/stat.h>
# include <unistd.h>
2010-07-22 09:08:17 -07:00
# include <Eina.h>
2012-02-21 13:01:22 -08:00
# include <Eet.h>
2013-11-04 01:31:48 -08:00
# include <Efl_Config.h>
2010-07-22 09:08:17 -07:00
# ifdef EAPI
# undef EAPI
# endif
# ifdef _WIN32
2010-07-23 04:00:44 -07:00
# ifdef EFL_EIO_BUILD
2010-07-22 09:08:17 -07:00
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# else
# define EAPI
# endif /* ! DLL_EXPORT */
# else
# define EAPI __declspec(dllimport)
2010-07-23 04:00:44 -07:00
# endif /* ! EFL_EIO_BUILD */
2010-07-22 09:08:17 -07:00
# else
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
# else
# define EAPI
# endif
# endif /* ! _WIN32 */
2010-10-12 07:59:30 -07:00
# ifdef __cplusplus
extern " C " {
# endif
2013-11-04 01:31:48 -08:00
# define EIO_VERSION_MAJOR EFL_VERSION_MAJOR
# define EIO_VERSION_MINOR EFL_VERSION_MINOR
2012-03-31 03:44:19 -07:00
2012-06-15 12:08:03 -07:00
/**
* @ typedef Eio_Version
* Represents the current version of EIO
*/
2012-03-16 21:17:29 -07:00
typedef struct _Eio_Version
{
2012-06-15 12:08:03 -07:00
int major ; /**< Major version number */
int minor ; /**< Minor version number */
int micro ; /**< Micro version number */
int revision ; /**< Revision number */
2012-03-16 21:17:29 -07:00
} Eio_Version ;
2012-03-31 03:44:19 -07:00
2012-03-16 21:17:29 -07:00
EAPI extern Eio_Version * eio_version ;
2012-03-31 03:44:19 -07:00
2010-10-12 07:59:30 -07:00
/**
2012-12-28 12:47:25 -08:00
* @ file
* @ brief Eio asynchronous input / output library
2010-10-12 07:59:30 -07:00
*
2012-12-28 12:47:25 -08:00
* These routines are used for Eio .
*/
/**
* @ page eio_main Eio
*
2012-12-28 15:26:05 -08:00
* @ date 2012 ( created )
*
* @ section toc Table of Contents
*
* @ li @ ref eio_main_intro
* @ li @ ref eio_main_compiling
* @ li @ ref eio_main_next_steps
* @ li @ ref eio_main_intro_example
*
* @ section eio_main_intro Introduction
2012-12-28 12:47:25 -08:00
*
* The Eio library is a library that implements an API for asynchronous
2015-05-10 14:02:07 -07:00
* input / output operation . Most operations are done in a separate thread
2012-12-28 12:47:25 -08:00
* to prevent lock . See @ ref Eio_Group . Some helper to work on data
* received in Eio callback are also provided see @ ref Eio_Helper .
* It is also possible to work asynchronously on Eina_File with @ ref Eio_Map
2015-05-10 14:02:07 -07:00
* or on Eet_File with @ ref Eio_Eet . It comes with way to manipulate
* eXtended attribute asynchronous with @ ref Eio_Xattr .
2012-12-28 12:47:25 -08:00
*
* This library is cross - platform and can be compiled and used on
* Linux , BSD , Opensolaris and Windows ( XP and CE ) . It is heavily
* based on @ ref Ecore_Main_Loop_Group .
2010-10-12 07:59:30 -07:00
*
2012-12-28 15:26:05 -08:00
* @ section eio_main_compiling How to compile
*
* Eio is a library your application links to . The procedure for this is
* very simple . You simply have to compile your application with the
* appropriate compiler flags that the @ c pkg - config script outputs . For
* example :
*
* Compiling C or C + + files into object files :
*
* @ verbatim
gcc - c - o main . o main . c ` pkg - config - - cflags eio `
@ endverbatim
*
* Linking object files into a binary executable :
*
* @ verbatim
gcc - o my_application main . o ` pkg - config - - libs eio `
@ endverbatim
*
* See @ ref pkgconfig
*
* @ section eio_main_next_steps Next Steps
*
2015-05-10 14:02:07 -07:00
* After you understand what Eio is and installed it on your system
* you should proceed understand the programming interface .
2012-12-28 15:26:05 -08:00
*
* Recommended reading :
*
* @ li @ ref Eio_Helper for common functions and library initialization .
2015-10-01 14:12:50 -07:00
* @ li @ ref Eio_List for listing files asynchronous .
* @ li @ ref Eio_Management for anyone who want to do a file manager ( copy , rm , . . . ) .
2012-12-28 15:26:05 -08:00
* @ li @ ref Eio_Map to manipulate files asynchronously ( mmap ) .
* @ li @ ref Eio_Xattr to access file extended attributes ( xattr ) .
* @ li @ ref Eio_Monitor to monitor for file changes ( inotify ) .
* @ li @ ref Eio_Eet to access Eet files asynchronously .
*
* @ section eio_main_intro_example Introductory Example
*
* @ include eio_file_ls . c
2012-06-15 12:08:03 -07:00
*
2012-12-28 15:26:05 -08:00
* More examples can be found at @ ref eio_examples .
2010-10-12 07:59:30 -07:00
*
*/
2010-10-20 12:17:30 -07:00
/**
* @ enum _Eio_File_Op
2012-06-15 12:08:03 -07:00
*
* @ brief Input / Output operations on files .
*
* This enum represents the operations that can be done .
2010-10-20 12:17:30 -07:00
*/
enum _Eio_File_Op
2010-08-03 10:11:44 -07:00
{
2012-03-01 19:36:28 -08:00
EIO_FILE_COPY , /**< I/O operation is about a specific file copy */
EIO_FILE_MOVE , /**< I/O operation is about a specific file move */
EIO_DIR_COPY , /**< I/O operation is about a specific directory copy */
EIO_DIR_MOVE , /**< I/O operation is about a specific directory move */
/** I/O operation is about destroying a path:
* source will point to base path to be destroyed ,
* and dest will point to to path destroyed by this I / O
*/
EIO_UNLINK ,
EIO_FILE_GETPWNAM , /**< I/O operation is trying to get uid from user name */
EIO_FILE_GETGRNAM /**< I/O operation is trying to get gid from user name */
2010-10-20 12:17:30 -07:00
} ;
2010-07-28 15:12:41 -07:00
2010-12-08 06:35:37 -08:00
/**
* @ typedef Eio_File_Op
* Input / Output operations on files .
*/
typedef enum _Eio_File_Op Eio_File_Op ;
2015-10-01 14:12:50 -07:00
/**
* @ defgroup Eio_List Eio file listing API
* @ ingroup Eio
*
* @ brief This functions helps list files asynchronously .
*
* This set of functions work on top of Eina_File and Ecore_Thread
* to list files under various condition .
*
* @ {
*/
2010-10-20 12:17:30 -07:00
/**
* @ typedef Eio_File
2012-03-01 19:36:28 -08:00
* Generic asynchronous I / O reference .
2010-10-20 12:17:30 -07:00
*/
typedef struct _Eio_File Eio_File ;
/**
* @ typedef Eio_Progress
* Progress information on a specific operation .
*/
typedef struct _Eio_Progress Eio_Progress ;
2010-07-22 09:08:17 -07:00
2010-11-12 06:08:01 -08:00
typedef Eina_Bool ( * Eio_Filter_Cb ) ( void * data , Eio_File * handler , const char * file ) ;
2012-02-22 08:30:43 -08:00
typedef void ( * Eio_Main_Cb ) ( void * data , Eio_File * handler , const char * file ) ;
2010-07-22 09:08:17 -07:00
2010-11-12 06:08:01 -08:00
typedef Eina_Bool ( * Eio_Filter_Direct_Cb ) ( void * data , Eio_File * handler , const Eina_File_Direct_Info * info ) ;
2012-02-22 03:51:45 -08:00
typedef Eina_Bool ( * Eio_Filter_Dir_Cb ) ( void * data , Eio_File * handler , Eina_File_Direct_Info * info ) ;
2012-02-22 08:30:43 -08:00
typedef void ( * Eio_Main_Direct_Cb ) ( void * data , Eio_File * handler , const Eina_File_Direct_Info * info ) ;
2010-07-22 09:08:17 -07:00
2012-02-23 03:46:51 -08:00
typedef void ( * Eio_Stat_Cb ) ( void * data , Eio_File * handler , const Eina_Stat * stat ) ;
2010-11-12 06:08:01 -08:00
typedef void ( * Eio_Progress_Cb ) ( void * data , Eio_File * handler , const Eio_Progress * info ) ;
2010-08-31 09:24:58 -07:00
2012-02-22 08:30:43 -08:00
typedef void ( * Eio_Eet_Open_Cb ) ( void * data , Eio_File * handler , Eet_File * file ) ;
typedef void ( * Eio_Open_Cb ) ( void * data , Eio_File * handler , Eina_File * file ) ;
2012-02-21 13:01:22 -08:00
typedef Eina_Bool ( * Eio_Filter_Map_Cb ) ( void * data , Eio_File * handler , void * map , size_t length ) ;
2012-02-22 08:30:43 -08:00
typedef void ( * Eio_Map_Cb ) ( void * data , Eio_File * handler , void * map , size_t length ) ;
2011-12-20 09:35:41 -08:00
2012-02-21 13:01:22 -08:00
typedef void ( * Eio_Done_Data_Cb ) ( void * data , Eio_File * handler , const char * read_data , unsigned int size ) ;
2011-09-16 07:18:08 -07:00
typedef void ( * Eio_Done_String_Cb ) ( void * data , Eio_File * handler , const char * xattr_string ) ;
typedef void ( * Eio_Done_Double_Cb ) ( void * data , Eio_File * handler , double xattr_double ) ;
2012-02-21 13:01:22 -08:00
typedef void ( * Eio_Done_Int_Cb ) ( void * data , Eio_File * handler , int i ) ;
2011-06-29 10:28:55 -07:00
2012-02-21 13:01:22 -08:00
typedef void ( * Eio_Done_ERead_Cb ) ( void * data , Eio_File * handler , void * decoded ) ;
typedef void ( * Eio_Done_Read_Cb ) ( void * data , Eio_File * handler , void * read_data , unsigned int size ) ;
2010-11-12 06:08:01 -08:00
typedef void ( * Eio_Done_Cb ) ( void * data , Eio_File * handler ) ;
typedef void ( * Eio_Error_Cb ) ( void * data , Eio_File * handler , int error ) ;
2012-02-21 13:01:22 -08:00
typedef void ( * Eio_Eet_Error_Cb ) ( void * data , Eio_File * handler , Eet_Error err ) ;
2010-07-22 09:08:17 -07:00
2012-06-15 12:08:03 -07:00
/**
* @ struct _Eio_Progress
* @ brief Represents the current progress of the operation .
*/
2010-08-31 09:24:58 -07:00
struct _Eio_Progress
{
2012-03-01 19:36:28 -08:00
Eio_File_Op op ; /**< I/O type */
2010-10-05 07:55:47 -07:00
2012-03-01 19:36:28 -08:00
long long current ; /**< Current step in the I/O operation */
long long max ; /**< Number of total steps to complete this I/O */
float percent ; /**< Percent done for the I/O operation */
* eio: add eio_file_copy (using splice when available and
fallback to mmap/write with huge tlb when not).
That what an eio_cp would look like :
#include <Ecore.h>
#include <Eio.h>
static void
_test_progress_cb(void *data, const Eio_Progress *info)
{
printf("%f (%zi / %zi octets)\n", info->percent, info->current, info->max);
}
static void
_test_done_cb(void *data)
{
printf("copy done\n");
ecore_main_loop_quit();
}
static void
_test_error_cb(int error, void *data)
{
fprintf(stderr, "error: [%s]\n", strerror(error));
ecore_main_loop_quit();
}
int
main(int argc, char **argv)
{
Eio_File *cp;
if (argc != 3)
{
fprintf(stderr, "eio_cp source_file destination_file\n");
return -1;
}
ecore_init();
eio_init();
cp = eio_file_copy(argv[1], argv[2],
_test_progress_cb,
_test_done_cb,
_test_error_cb,
NULL);
ecore_main_loop_begin();
eio_shutdown();
ecore_shutdown();
return 0;
}
SVN revision: 52787
2010-09-26 14:47:48 -07:00
2012-03-01 19:36:28 -08:00
const char * source ; /**< source of the I/O operation */
const char * dest ; /**< target of the I/O operation */
2010-08-31 09:24:58 -07:00
} ;
2011-12-03 05:21:07 -08:00
/**
2012-03-01 19:36:28 -08:00
* @ brief List contents of a directory without locking your app .
2011-12-03 05:21:07 -08:00
* @ param dir The directory to list .
2012-06-15 12:08:03 -07:00
* @ param filter_cb Callback used to decide if the file will be passed to main_cb
* @ param main_cb Callback called for each listed file if it was not filtered .
* @ param done_cb Callback called when the ls operation is done .
* @ param error_cb Callback called when either the directory could not be opened or the operation has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* This function is responsible for listing the content of a directory without blocking your application .
* It ' s equivalent to the " ls " shell command . Every file will be passed to the
* filter_cb , so it ' s your job to decide if you want to pass the file to the
* main_cb or not . Return EINA_TRUE to pass it to the main_cb or EINA_FALSE to
2015-10-01 14:12:50 -07:00
* ignore it . It runs eina_file_ls ( ) in a separate thread using
* ecore_thread_feedback_run ( ) .
*
* @ see eina_file_ls ( )
* @ see ecore_thread_feedback_run ( )
* @ see eio_file_direct_ls ( )
* @ see eio_file_stat_ls ( )
2011-12-03 05:21:07 -08:00
*/
2010-07-23 04:00:44 -07:00
EAPI Eio_File * eio_file_ls ( const char * dir ,
2015-10-01 14:12:50 -07:00
Eio_Filter_Cb filter_cb ,
Eio_Main_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-07-22 09:08:17 -07:00
2011-12-03 05:21:07 -08:00
/**
2012-03-01 19:36:28 -08:00
* @ brief List contents of a directory without locking your app .
2011-12-03 05:21:07 -08:00
* @ param dir The directory to list .
2012-06-15 12:08:03 -07:00
* @ param filter_cb Callback used to decide if the file will be passed to main_cb
* @ param main_cb Callback called from the main loop for each accepted file ( not filtered ) .
2012-03-01 19:36:28 -08:00
* @ param done_cb Callback called from the main loop after the contents of the directory has been listed .
* @ param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled .
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2015-10-01 14:12:50 -07:00
* eio_file_direct_ls ( ) runs eina_file_direct_ls ( ) in a separate thread using
* ecore_thread_feedback_run ( ) . This prevents any blocking in your apps .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
* the main_cb or EINA_FALSE to ignore it .
2015-10-01 14:12:50 -07:00
*
* @ warning If readdir_r doesn ' t contain file type information , file type is
* EINA_FILE_UNKNOWN .
*
* @ note The iterator walks over ' . ' and ' . . ' without returning them .
* @ note The difference between this function and eina_file_stat_ls ( ) is that
* it may not get the file type information however it is likely to be
* faster .
*
* @ see eio_file_stat_ls ( )
* @ see eina_file_direct_ls ( )
* @ see ecore_thread_feedback_run ( )
2011-12-03 05:21:07 -08:00
*/
2010-07-23 04:00:44 -07:00
EAPI Eio_File * eio_file_direct_ls ( const char * dir ,
2015-10-01 14:12:50 -07:00
Eio_Filter_Direct_Cb filter_cb ,
Eio_Main_Direct_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-07-22 09:08:17 -07:00
2011-12-03 05:21:07 -08:00
/**
* @ brief List content of a directory without locking your app .
* @ param dir The directory to list .
2012-06-15 12:08:03 -07:00
* @ param filter_cb Callback used to decide if the file will be passed to main_cb
* @ param main_cb Callback called from the main loop for each accepted file ( not filtered ) .
2012-03-01 19:36:28 -08:00
* @ param done_cb Callback called from the main loop after the contents of the directory has been listed .
* @ param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled .
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
2015-10-01 14:12:50 -07:00
* the main_cb or EINA_FALSE to ignore it . eio_file_stat_ls ( ) run eina_file_stat_ls ( )
* in a separate thread using ecore_thread_feedback_run ( ) .
2012-06-15 12:08:03 -07:00
*
2015-10-01 14:12:50 -07:00
* @ note The iterator walks over ' . ' and ' . . ' without returning them .
* @ note The difference between this function and eio_file_direct_ls ( ) is that
* it guarantees the file type information to be correct by incurring a
* possible performance penalty .
*
* @ see eio_file_stat_ls ( )
* @ see eina_file_stat_ls ( )
* @ see ecore_thread_feedback_run ( )
2011-12-03 05:21:07 -08:00
*/
2010-11-02 10:08:00 -07:00
EAPI Eio_File * eio_file_stat_ls ( const char * dir ,
Eio_Filter_Direct_Cb filter_cb ,
Eio_Main_Direct_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
2014-08-17 09:10:39 -07:00
* @ brief List the content of a directory and all its sub - content asynchronously
2011-12-03 05:21:07 -08:00
* @ param dir The directory to list .
2012-06-15 12:08:03 -07:00
* @ param filter_cb Callback used to decide if the file will be passed to main_cb
* @ param main_cb Callback called from the main loop for each accepted file ( not filtered ) .
2012-03-01 19:36:28 -08:00
* @ param done_cb Callback called from the main loop after the contents of the directory has been listed .
* @ param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled .
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_dir_stat_ls ( ) runs eina_file_stat_ls ( ) recursively in a separate thread using
2015-10-01 14:12:50 -07:00
* ecore_thread_feedback_run ( ) . This prevents any blocking in your apps .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the
* filter_cb , so it ' s your job to decide if you want to pass the file to the
* main_cb or not . Return EINA_TRUE to pass it to the main_cb or EINA_FALSE to
* ignore it .
2015-10-01 14:12:50 -07:00
*
* @ see eio_file_stat_ls ( )
* @ see eio_dir_direct_ls ( )
* @ see eina_file_stat_ls ( )
* @ see ecore_thread_feedback_run ( )
2011-12-03 05:21:07 -08:00
*/
2011-02-17 07:59:07 -08:00
EAPI Eio_File * eio_dir_stat_ls ( const char * dir ,
2012-06-20 11:11:20 -07:00
Eio_Filter_Direct_Cb filter_cb ,
2011-02-17 07:59:07 -08:00
Eio_Main_Direct_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 02:26:39 -08:00
/**
2014-08-17 09:10:39 -07:00
* @ brief List the content of a directory and all its sub - content asynchronously
2012-02-22 02:26:39 -08:00
* @ param dir The directory to list .
2012-06-15 12:08:03 -07:00
* @ param filter_cb Callback used to decide if the file will be passed to main_cb
* @ param main_cb Callback called from the main loop for each accepted file ( not filtered ) .
2012-03-01 19:36:28 -08:00
* @ param done_cb Callback called from the main loop after the contents of the directory has been listed .
* @ param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled .
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2012-02-22 02:26:39 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_dir_direct_ls ( ) runs eina_file_direct_ls ( ) recursively in a separate thread using
2015-10-01 14:12:50 -07:00
* ecore_thread_feedback_run ( ) . This prevents any blocking in your apps .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
* the main_cb or EINA_FALSE to ignore it .
2015-10-01 14:12:50 -07:00
*
* @ see eio_file_direct_ls ( )
* @ see eio_dir_stat_ls ( )
* @ see eina_file_direct_ls ( )
* @ see ecore_thread_feedback_run ( )
2012-02-22 02:26:39 -08:00
*/
EAPI Eio_File * eio_dir_direct_ls ( const char * dir ,
2015-10-01 14:12:50 -07:00
Eio_Filter_Dir_Cb filter_cb ,
Eio_Main_Direct_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 02:26:39 -08:00
2011-12-03 05:21:07 -08:00
/**
* @ brief Stat a file / directory .
* @ param path The path to stat .
2012-03-01 19:36:28 -08:00
* @ param done_cb Callback called from the main loop when stat was successfully called .
2011-12-03 05:21:07 -08:00
* @ param error_cb Callback called from the main loop when stat failed or has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_direct_stat calls stat in another thread . This prevents any blocking in your apps .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_file_direct_stat ( const char * path ,
2015-10-01 14:12:50 -07:00
Eio_Stat_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
/**
* @ }
*/
/**
* @ defgroup Eio_Management Eio file management API .
*
* @ brief A set of function to manage file asynchronously .
*
* The function provided by this API are the one useful for any
* file manager . Like moving or copying a file , unlinking it , changing
* it ' s access right , . . .
*
* @ {
*/
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
2015-05-10 14:02:07 -07:00
* @ brief Change rights of a path .
* @ param path The directory path to change access rights .
2011-12-03 05:21:07 -08:00
* @ param mode The permission to set , follow ( mode & ~ umask & 0777 ) .
2012-06-15 12:08:03 -07:00
* @ param done_cb Callback called when the operation is completed .
* @ param error_cb Callback called from if something goes wrong .
* @ param data Unmodified user data passed to callbacks .
2012-03-01 19:36:28 -08:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* Set a new permission of a path changing it to the mode passed as argument .
* It ' s equivalent to the chmod command .
2011-12-03 05:21:07 -08:00
*/
2010-10-20 09:42:45 -07:00
EAPI Eio_File * eio_file_chmod ( const char * path ,
mode_t mode ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Change owner of a path .
* @ param path The directory path to change owner .
2012-03-01 19:36:28 -08:00
* @ param user The new user to set ( can be NULL ) .
* @ param group The new group to set ( can be NULL ) .
2012-06-15 12:08:03 -07:00
* @ param done_cb Callback called when the operation is completed .
* @ param error_cb Callback called from if something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* This function will change the owner of a path , setting it to the user and
* group passed as argument . It ' s equivalent to the chown shell command .
2011-12-03 05:21:07 -08:00
*/
2010-10-20 09:42:45 -07:00
EAPI Eio_File * eio_file_chown ( const char * path ,
const char * user ,
const char * group ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Unlink a file / directory .
* @ param path The path to unlink .
2012-06-15 12:08:03 -07:00
* @ param done_cb Callback called when the operation is completed .
* @ param error_cb Callback called from if something goes wrong .
* @ param data Unmodified user data passed to callbacks .
2012-03-01 19:36:28 -08:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* This function will erase a file .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_file_unlink ( const char * path ,
2015-10-01 14:12:50 -07:00
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
* @ brief Create a new directory .
* @ param path The directory path to create .
* @ param mode The permission to set , follow ( mode & ~ umask & 0777 ) .
2012-06-15 12:08:03 -07:00
* @ param done_cb Callback called when the operation is completed .
* @ param error_cb Callback called from if something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-06-15 12:08:03 -07:00
* Creates a new directory using the mode provided .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_file_mkdir ( const char * path ,
2015-10-01 14:12:50 -07:00
mode_t mode ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
* @ brief Move a file asynchronously
* @ param source Should be the name of the file to move the data from .
* @ param dest Should be the name of the file to move the data to .
* @ param progress_cb Callback called to know the progress of the move .
* @ param done_cb Callback called when the move is done .
* @ param error_cb Callback called when something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2014-10-13 08:10:05 -07:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2014-10-20 01:32:39 -07:00
* @ return an Eio_File pointer , handler to the move operation , can be used to cancel the operation
*
2011-12-03 05:21:07 -08:00
* This function will copy a file from source to dest . It will try to use splice
* if possible , if not it will fallback to mmap / write . It will try to preserve
2015-05-10 14:02:07 -07:00
* access rights , but not user / group identification .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_file_move ( const char * source ,
2015-10-01 14:12:50 -07:00
const char * dest ,
Eio_Progress_Cb progress_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
* @ brief Copy a file asynchronously
* @ param source Should be the name of the file to copy the data from .
* @ param dest Should be the name of the file to copy the data to .
* @ param progress_cb Callback called to know the progress of the copy .
* @ param done_cb Callback called when the copy is done .
* @ param error_cb Callback called when something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2011-12-03 05:21:07 -08:00
*
2014-10-20 01:32:39 -07:00
* @ return an Eio_File pointer , handler to the copy operation , can be used to cancel the operation
*
2011-12-03 05:21:07 -08:00
* This function will copy a file from source to dest . It will try to use splice
* if possible , if not it will fallback to mmap / write . It will try to preserve
2015-05-10 14:02:07 -07:00
* access rights , but not user / group identification .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_file_copy ( const char * source ,
2015-10-01 14:12:50 -07:00
const char * dest ,
Eio_Progress_Cb progress_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
2014-08-17 09:10:39 -07:00
* @ brief Move a directory and its content asynchronously
2011-12-03 05:21:07 -08:00
* @ param source Should be the name of the directory to copy the data from .
* @ param dest Should be the name of the directory to copy the data to .
2012-02-22 08:30:43 -08:00
* @ param filter_cb Possible to deny the move of some files / directories .
2011-12-03 05:21:07 -08:00
* @ param progress_cb Callback called to know the progress of the copy .
* @ param done_cb Callback called when the copy is done .
* @ param error_cb Callback called when something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2014-10-13 08:10:05 -07:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2014-10-20 01:32:39 -07:00
* @ return an Eio_File pointer , handler to the move operation , can be used to cancel the operation
*
2014-08-17 09:10:39 -07:00
* This function will move a directory and all its content from source to dest .
2011-12-03 05:21:07 -08:00
* It will try first to rename the directory , if not it will try to use splice
* if possible , if not it will fallback to mmap / write .
2015-05-10 14:02:07 -07:00
* It will try to preserve access rights , but not user / group identity .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
* the main_cb or EINA_FALSE to ignore it .
2012-02-22 08:30:43 -08:00
*
2015-05-10 14:02:07 -07:00
* @ note if a rename occurs , the filter callback will not be called .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_dir_move ( const char * source ,
2015-10-01 14:12:50 -07:00
const char * dest ,
2011-03-09 08:21:11 -08:00
Eio_Filter_Direct_Cb filter_cb ,
2015-10-01 14:12:50 -07:00
Eio_Progress_Cb progress_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
2014-08-17 09:10:39 -07:00
* @ brief Copy a directory and its content asynchronously
2011-12-03 05:21:07 -08:00
* @ param source Should be the name of the directory to copy the data from .
* @ param dest Should be the name of the directory to copy the data to .
2012-02-22 08:30:43 -08:00
* @ param filter_cb Possible to deny the move of some files / directories .
2011-12-03 05:21:07 -08:00
* @ param progress_cb Callback called to know the progress of the copy .
* @ param done_cb Callback called when the copy is done .
* @ param error_cb Callback called when something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2014-10-13 08:10:05 -07:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2014-10-20 01:32:39 -07:00
* @ return an Eio_File pointer , handler to the copy operation , can be used to cancel the operation
*
2014-08-17 09:10:39 -07:00
* This function will copy a directory and all its content from source to dest .
2011-12-03 05:21:07 -08:00
* It will try to use splice if possible , if not it will fallback to mmap / write .
2015-05-10 14:02:07 -07:00
* It will try to preserve access rights , but not user / group identity .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
* the main_cb or EINA_FALSE to ignore it .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_dir_copy ( const char * source ,
2015-10-01 14:12:50 -07:00
const char * dest ,
2011-03-09 08:21:11 -08:00
Eio_Filter_Direct_Cb filter_cb ,
2015-10-01 14:12:50 -07:00
Eio_Progress_Cb progress_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2010-08-31 09:24:58 -07:00
2011-12-03 05:21:07 -08:00
/**
2014-08-17 09:10:39 -07:00
* @ brief Remove a directory and its content asynchronously
2011-12-03 05:21:07 -08:00
* @ param path Should be the name of the directory to destroy .
2012-02-22 08:30:43 -08:00
* @ param filter_cb Possible to deny the move of some files / directories .
2011-12-03 05:21:07 -08:00
* @ param progress_cb Callback called to know the progress of the copy .
* @ param done_cb Callback called when the copy is done .
* @ param error_cb Callback called when something goes wrong .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2014-10-13 08:10:05 -07:00
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2014-10-20 01:32:39 -07:00
* @ return an Eio_File pointer , handler to the unlink operation , can be used to cancel the operation
*
2014-08-17 09:10:39 -07:00
* This function will remove a directory and all its content .
2012-06-15 12:08:03 -07:00
* Every file will be passed to the filter_cb , so it ' s your job to decide if you
* want to pass the file to the main_cb or not . Return EINA_TRUE to pass it to
* the main_cb or EINA_FALSE to ignore it .
2011-12-03 05:21:07 -08:00
*/
2010-08-31 09:24:58 -07:00
EAPI Eio_File * eio_dir_unlink ( const char * path ,
2011-03-09 08:21:11 -08:00
Eio_Filter_Direct_Cb filter_cb ,
2015-10-01 14:12:50 -07:00
Eio_Progress_Cb progress_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
* @ }
*/
/**
* @ defgroup Eio_Xattr Eio manipulation of eXtended attribute .
2012-12-28 12:47:25 -08:00
* @ ingroup Eio
2012-02-22 08:30:43 -08:00
*
* @ brief A set of function to manipulate data associated with a specific file
*
2012-06-15 12:08:03 -07:00
* The functions provided by this API are responsible to manage Extended
* attribute files . Like file authors , character encoding , checksum , etc .
2012-02-22 08:30:43 -08:00
* @ {
*/
2010-08-31 09:24:58 -07:00
2011-12-30 07:22:42 -08:00
/**
2015-05-10 14:02:07 -07:00
* @ brief Asynchronously list all eXtended attribute
2011-12-30 07:22:42 -08:00
* @ param path The path to get the eXtended attribute from .
* @ param filter_cb Callback called in the thread to validate the eXtended attribute .
* @ param main_cb Callback called in the main loop for each accepted eXtended attribute .
* @ param done_cb Callback called in the main loop when the all the eXtended attribute have been listed .
* @ param error_cb Callback called in the main loop when something goes wrong during the listing of the eXtended attribute .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-30 07:22:42 -08:00
*/
2011-06-29 07:16:41 -07:00
EAPI Eio_File * eio_file_xattr ( const char * path ,
Eio_Filter_Cb filter_cb ,
Eio_Main_Cb main_cb ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Define an extented attribute on a file / directory .
* @ param path The path to set the attribute on .
* @ param attribute The name of the attribute to define .
* @ param xattr_int The value to link the attribute with .
2014-04-10 06:27:51 -07:00
* @ param flags Whether to insert , replace or create the attribute .
2011-12-03 05:21:07 -08:00
* @ param done_cb The callback called from the main loop when setxattr succeeded .
* @ param error_cb The callback called from the main loop when setxattr failed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_int_set calls eina_xattr_int_set from another thread . This prevents blocking in your apps . If
2015-05-10 14:02:07 -07:00
* the writing succeeded , the done_cb will be called even if a cancel was requested , but came too late .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_int_set ( const char * path ,
const char * attribute ,
int xattr_int ,
Eina_Xattr_Flags flags ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Define an extented attribute on a file / directory .
* @ param path The path to set the attribute on .
* @ param attribute The name of the attribute to define .
* @ param xattr_double The value to link the attribute with .
2014-04-10 06:27:51 -07:00
* @ param flags Whether to insert , replace or create the attribute .
2011-12-03 05:21:07 -08:00
* @ param done_cb The callback called from the main loop when setxattr succeeded .
* @ param error_cb The callback called from the main loop when setxattr failed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_double_set calls eina_xattr_double_set from another thread . This prevents blocking in your apps . If
2015-05-10 14:02:07 -07:00
* the writing succeeded , the done_cb will be called even if a cancel was requested , but came too late .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_double_set ( const char * path ,
const char * attribute ,
double xattr_double ,
Eina_Xattr_Flags flags ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Define a string extented attribute on a file / directory .
* @ param path The path to set the attribute on .
* @ param attribute The name of the attribute to define .
* @ param xattr_string The string to link the attribute with .
2014-04-10 06:27:51 -07:00
* @ param flags Whether to insert , replace or create the attribute .
2011-12-03 05:21:07 -08:00
* @ param done_cb The callback called from the main loop when setxattr succeeded .
* @ param error_cb The callback called from the main loop when setxattr failed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_string_set calls eina_xattr_string_set from another thread . This prevents blocking in your apps . If
2015-05-10 14:02:07 -07:00
* the writing succeeded , the done_cb will be called even if a cancel was requested , but came too late .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_string_set ( const char * path ,
const char * attribute ,
const char * xattr_string ,
Eina_Xattr_Flags flags ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Define an extented attribute on a file / directory .
* @ param path The path to set the attribute on .
* @ param attribute The name of the attribute to define .
* @ param xattr_data The data to link the attribute with .
* @ param xattr_size The size of the data to set .
2014-04-10 06:27:51 -07:00
* @ param flags Whether to insert , replace or create the attribute .
2011-12-03 05:21:07 -08:00
* @ param done_cb The callback called from the main loop when setxattr succeeded .
* @ param error_cb The callback called from the main loop when setxattr failed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_set calls setxattr from another thread . This prevents blocking in your apps . If
2015-05-10 14:02:07 -07:00
* the writing succeeded , the done_cb will be called even if a cancel was requested , but came too late .
2011-12-03 05:21:07 -08:00
*/
2011-06-29 10:28:55 -07:00
EAPI Eio_File * eio_file_xattr_set ( const char * path ,
const char * attribute ,
const char * xattr_data ,
unsigned int xattr_size ,
2011-09-16 04:14:57 -07:00
Eina_Xattr_Flags flags ,
2011-06-29 10:28:55 -07:00
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Retrieve the extended attribute of a file / directory .
* @ param path The path to retrieve the extended attribute from .
* @ param attribute The name of the attribute to retrieve .
* @ param done_cb Callback called from the main loop when getxattr succeeded .
* @ param error_cb Callback called from the main loop when getxattr failed or has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_get calls getxattr from another thread . This prevents blocking in your apps .
2011-12-03 05:21:07 -08:00
*/
2011-06-29 10:28:55 -07:00
EAPI Eio_File * eio_file_xattr_get ( const char * path ,
const char * attribute ,
2011-09-16 07:18:08 -07:00
Eio_Done_Data_Cb done_cb ,
2011-06-29 10:28:55 -07:00
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Retrieve a extended attribute of a file / directory .
* @ param path The path to retrieve the extended attribute from .
* @ param attribute The name of the attribute to retrieve .
* @ param done_cb Callback called from the main loop when getxattr succeeded .
* @ param error_cb Callback called from the main loop when getxattr failed or has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_int_get calls eina_xattr_int_get from another thread . This prevents blocking in your apps .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_int_get ( const char * path ,
const char * attribute ,
Eio_Done_Int_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Retrieve a extended attribute of a file / directory .
* @ param path The path to retrieve the extended attribute from .
* @ param attribute The name of the attribute to retrieve .
* @ param done_cb Callback called from the main loop when getxattr succeeded .
* @ param error_cb Callback called from the main loop when getxattr failed or has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_double_get calls eina_xattr_double_get from another thread . This prevents blocking in your apps .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_double_get ( const char * path ,
const char * attribute ,
Eio_Done_Double_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Retrieve a string extended attribute of a file / directory .
* @ param path The path to retrieve the extended attribute from .
* @ param attribute The name of the attribute to retrieve .
* @ param done_cb Callback called from the main loop when getxattr succeeded .
* @ param error_cb Callback called from the main loop when getxattr failed or has been canceled .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
* @ return A reference to the I / O operation .
2011-12-03 05:21:07 -08:00
*
2012-03-01 19:36:28 -08:00
* eio_file_xattr_string_get calls eina_xattr_string_get from another thread . This prevents blocking in your apps .
2011-12-03 05:21:07 -08:00
*/
2011-09-16 07:18:08 -07:00
EAPI Eio_File * eio_file_xattr_string_get ( const char * path ,
const char * attribute ,
Eio_Done_String_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2011-06-29 10:28:55 -07:00
2012-02-22 08:30:43 -08:00
/**
* @ }
*/
/**
* @ defgroup Eio_Helper Eio Reference helper API
2012-12-28 12:47:25 -08:00
* @ ingroup Eio
2012-02-22 08:30:43 -08:00
*
* @ brief This are helper provided around core Eio API .
*
* This set of functions do provide helper to work around data
* provided by Eio without the need to look at system header .
*
* @ {
*/
/**
2014-08-17 09:10:39 -07:00
* @ brief Initialize eio and all its required submodule .
2012-02-22 08:30:43 -08:00
* @ return the current number of eio users .
*/
EAPI int eio_init ( void ) ;
/**
2014-08-17 09:10:39 -07:00
* @ brief Shutdown eio and all its submodule if possible .
2012-02-22 08:30:43 -08:00
* @ return the number of pending users of eio .
*/
EAPI int eio_shutdown ( void ) ;
2014-03-04 21:06:39 -08:00
/**
* @ brief Set the limit to the maximum amount of memory used
* @ param limit The actual limit to set .
*
* Eio work by burst , allocating memory in a thread and moving it
* back to the main loop . This result in quite some huge memory
* usage if the main loop is to slow to cope with the speed of the
* thread . By setting this limit , the thread will block until
* enough memory has been freed to be below the limit again .
*
* By default no limit is set and any value < 0 will mean no limit .
*
* @ note You should give at least a reasonable amount of memory or
* the thread might stall .
* @ since 1.10
*/
EAPI void eio_memory_burst_limit_set ( size_t limit ) ;
/**
* @ brief Get the actual limit to the maximum amount of memory used
* @ return The current limit being set .
*
* @ since 1.10
* @ see eio_memory_burst_limit_set
*/
EAPI size_t eio_memory_burst_limit_get ( void ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Return the container during EIO operation
2012-03-01 19:36:28 -08:00
* @ param ls The asynchronous I / O operation to retrieve container from .
2011-12-03 05:21:07 -08:00
* @ return NULL if not available , a DIRP if it is .
*
* This is only available and make sense in the thread callback , not in
* the mainloop .
*/
2011-05-24 03:41:37 -07:00
EAPI void * eio_file_container_get ( Eio_File * ls ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Cancel any Eio_File .
2012-03-01 19:36:28 -08:00
* @ param ls The asynchronous I / O operation to cancel .
2011-12-03 05:21:07 -08:00
* @ return EINA_FALSE if the destruction is delayed , EINA_TRUE if it ' s done .
*
2012-03-01 19:36:28 -08:00
* This will cancel any kind of I / O operation and cleanup the mess . This means
* that it could take time to cancel an I / O .
2011-12-03 05:21:07 -08:00
*/
2010-07-23 04:00:44 -07:00
EAPI Eina_Bool eio_file_cancel ( Eio_File * ls ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Check if an Eio_File operation has been cancelled .
2012-03-01 19:36:28 -08:00
* @ param ls The asynchronous I / O operation to check .
2011-12-03 05:21:07 -08:00
* @ return EINA_TRUE if it was canceled , EINA_FALSE other wise .
*
* In case of an error it also return EINA_TRUE .
*/
2011-06-25 15:52:01 -07:00
EAPI Eina_Bool eio_file_check ( Eio_File * ls ) ;
2010-07-22 09:08:17 -07:00
2011-12-03 05:21:07 -08:00
/**
* @ brief Associate data with the current filtered file .
* @ param ls The Eio_File ls request currently calling the filter callback .
* @ param key The key to associate data to .
* @ param data The data to associate the data to .
2012-09-24 15:22:46 -07:00
* @ param free_cb Optionally a function to call to free the associated data ,
2014-01-05 21:00:18 -08:00
* @ p data is passed as the callback data parameter . If no @ p free_cb is provided
2012-09-24 15:22:46 -07:00
* the user @ p data remains untouched .
2011-12-03 05:21:07 -08:00
* @ return EINA_TRUE if insertion was fine .
*
2012-03-01 19:36:28 -08:00
* This function can only be safely called from within the filter callback .
2011-12-03 05:21:07 -08:00
* If you don ' t need to copy the key around you can use @ ref eio_file_associate_direct_add
*/
2011-06-22 10:45:22 -07:00
EAPI Eina_Bool eio_file_associate_add ( Eio_File * ls ,
const char * key ,
2011-06-23 06:29:45 -07:00
const void * data , Eina_Free_Cb free_cb ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Associate data with the current filtered file .
* @ param ls The Eio_File ls request currently calling the filter callback .
2012-03-01 19:36:28 -08:00
* @ param key The key to associate data to ( will not be copied , and the pointer will not be used as long as the file is not notified ) .
2011-12-03 05:21:07 -08:00
* @ param data The data to associate the data to .
2014-01-05 21:00:18 -08:00
* @ param free_cb The function to call to free the associated data , @ p free_cb will be called if not specified .
2011-12-03 05:21:07 -08:00
* @ return EINA_TRUE if insertion was fine .
*
2012-03-01 19:36:28 -08:00
* This function can only be safely called from within the filter callback .
2011-12-03 05:21:07 -08:00
* If you need eio to make a proper copy of the @ p key to be safe use
* @ ref eio_file_associate_add instead .
*/
2011-06-22 10:45:22 -07:00
EAPI Eina_Bool eio_file_associate_direct_add ( Eio_File * ls ,
const char * key ,
2011-06-23 06:29:45 -07:00
const void * data , Eina_Free_Cb free_cb ) ;
2011-12-03 05:21:07 -08:00
/**
* @ brief Get the data associated during the filter callback inside the main loop
* @ param ls The Eio_File ls request currently calling the notify callback .
* @ param key The key pointing to the data to retrieve .
* @ return the data associated with the key or @ p NULL if not found .
*/
2011-06-22 10:45:22 -07:00
EAPI void * eio_file_associate_find ( Eio_File * ls , const char * key ) ;
2011-12-03 05:21:07 -08:00
/**
2012-02-23 03:46:51 -08:00
* @ brief get access time from a Eina_Stat
2012-02-22 08:30:43 -08:00
* @ param stat the structure to get the atime from
* @ return the last accessed time
*
* This take care of doing type conversion to match rest of EFL time API .
* @ note some filesystem don ' t update that information .
2011-12-03 05:21:07 -08:00
*/
2012-02-23 03:46:51 -08:00
static inline double eio_file_atime ( const Eina_Stat * stat ) ;
2011-12-03 05:21:07 -08:00
2010-10-28 07:50:24 -07:00
/**
2012-02-23 03:46:51 -08:00
* @ brief get modification time from a Eina_Stat
2012-02-22 08:30:43 -08:00
* @ param stat the structure to get the mtime from
* @ return the last modification time
*
* This take care of doing type conversion to match rest of EFL time API .
2010-10-28 07:50:24 -07:00
*/
2012-02-23 03:46:51 -08:00
static inline double eio_file_mtime ( const Eina_Stat * stat ) ;
2010-10-28 07:50:24 -07:00
/**
2012-02-23 03:46:51 -08:00
* @ brief get the size of the file described in Eina_Stat
2012-02-22 08:30:43 -08:00
* @ param stat the structure to get the size from
* @ return the size of the file
2010-10-28 07:50:24 -07:00
*/
2012-02-23 03:46:51 -08:00
static inline long long eio_file_size ( const Eina_Stat * stat ) ;
2012-02-22 08:30:43 -08:00
/**
* @ brief tell if the stated path was a directory or not .
* @ param stat the structure to get the size from
* @ return EINA_TRUE , if it was .
*/
2012-02-23 03:46:51 -08:00
static inline Eina_Bool eio_file_is_dir ( const Eina_Stat * stat ) ;
2012-02-22 08:30:43 -08:00
/**
* @ brief tell if the stated path was a link or not .
* @ param stat the structure to get the size from
* @ return EINA_TRUE , if it was .
*/
2012-02-23 03:46:51 -08:00
static inline Eina_Bool eio_file_is_lnk ( const Eina_Stat * stat ) ;
2010-10-28 07:50:24 -07:00
2011-04-25 10:04:46 -07:00
/**
* @ }
*/
/**
*
*/
2011-12-20 09:35:41 -08:00
/**
2012-03-01 19:36:28 -08:00
* @ defgroup Eio_Map Manipulate an Eina_File asynchronously
2012-12-28 12:47:25 -08:00
* @ ingroup Eio
2011-12-20 09:35:41 -08:00
*
2015-05-10 14:02:07 -07:00
* @ brief This function helps when manipulating a file asynchronously .
2011-12-30 07:31:16 -08:00
*
2015-05-10 14:02:07 -07:00
* 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
2012-06-15 12:08:03 -07:00
* memory .
2011-12-30 07:31:16 -08:00
* @ {
2011-12-20 09:35:41 -08:00
*/
/**
2015-05-10 14:02:07 -07:00
* @ brief Asynchronously open a file .
2011-12-20 09:35:41 -08:00
* @ param name The file to open .
2012-06-15 12:08:03 -07:00
* @ param shared If it ' s a shared memory file .
2011-12-20 09:35:41 -08:00
* @ param open_cb Callback called in the main loop when the file has been successfully opened .
* @ param error_cb Callback called in the main loop when the file couldn ' t be opened .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2015-09-28 09:27:35 -07:00
* @ return Pointer to the file if successful or NULL otherwise .
2012-06-15 12:08:03 -07:00
*
2011-12-20 09:35:41 -08:00
*/
EAPI Eio_File * eio_file_open ( const char * name , Eina_Bool shared ,
Eio_Open_Cb open_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
/**
2015-05-10 14:02:07 -07:00
* @ brief Asynchronously close a file .
2011-12-20 09:35:41 -08:00
* @ param f The file to close .
* @ param done_cb Callback called in the main loop when the file has been successfully closed .
* @ param error_cb Callback called in the main loop when the file couldn ' t be closed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2015-09-28 09:27:35 -07:00
* @ return Pointer to the file if successful or NULL otherwise .
2011-12-20 09:35:41 -08:00
*/
EAPI Eio_File * eio_file_close ( Eina_File * f ,
Eio_Done_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
/**
2015-05-10 14:02:07 -07:00
* @ brief Asynchronously map a file in memory .
2011-12-20 09:35:41 -08:00
* @ param f The file to map .
* @ param rule The rule to apply to the map .
* @ param filter_cb Callback called in the thread to validate the content of the map .
* @ param map_cb Callback called in the main loop when the file has been successfully mapped .
* @ param error_cb Callback called in the main loop when the file can ' t be mapped .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2015-09-28 09:27:35 -07:00
* @ return Pointer to the file if successful or NULL otherwise .
2011-12-20 09:35:41 -08:00
*
* The container of the Eio_File is the Eina_File .
*/
EAPI 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 ) ;
/**
2015-05-10 14:02:07 -07:00
* @ brief Asynchronously map a part of a file in memory .
2011-12-20 09:35:41 -08:00
* @ param f The file to map .
* @ param rule The rule to apply to the map .
* @ param offset The offset inside the file
* @ param length The length of the memory to map
* @ param filter_cb Callback called in the thread to validate the content of the map .
* @ param map_cb Callback called in the main loop when the file has been successfully mapped .
* @ param error_cb Callback called in the main loop when the file can ' t be mapped .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2015-09-28 09:27:35 -07:00
* @ return Pointer to the file if successful or NULL otherwise .
2011-12-20 09:35:41 -08:00
*
* The container of the Eio_File is the Eina_File .
*/
EAPI 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 ) ;
/**
* @ }
*/
2012-02-21 13:01:22 -08:00
/**
* @ defgroup Eio_Eet Eio asynchronous API for Eet file .
2012-12-28 12:47:25 -08:00
* @ ingroup Eio
2012-02-21 13:01:22 -08:00
*
2012-06-15 12:08:03 -07:00
* @ brief This set of functions help in the asynchronous use of Eet
2012-02-21 13:01:22 -08:00
*
* @ {
*/
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Open an eet file on disk , and returns a handle to it asynchronously .
2012-02-22 08:30:43 -08:00
* @ param filename The file path to the eet file . eg : @ c " /tmp/file.eet " .
* @ param mode The mode for opening . Either EET_FILE_MODE_READ ,
* EET_FILE_MODE_WRITE or EET_FILE_MODE_READ_WRITE .
* @ param eet_cb The callback to call when the file has been successfully opened .
* @ param error_cb Callback called in the main loop when the file can ' t be opened .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*
2012-03-01 19:36:28 -08:00
* This function calls eet_open ( ) from another thread using Ecore_Thread .
2012-02-22 08:30:43 -08:00
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_open ( const char * filename ,
Eet_File_Mode mode ,
Eio_Eet_Open_Cb eet_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Close an eet file handle and flush pending writes asynchronously .
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle .
* @ param done_cb Callback called from the main loop when the file has been closed .
* @ param error_cb Callback called in the main loop when the file can ' t be closed .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*
* This function will call eet_close ( ) from another thread by
* using Ecore_Thread . You should assume that the Eet_File is dead after this
2012-03-01 19:36:28 -08:00
* function is called .
2012-02-22 08:30:43 -08:00
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_close ( Eet_File * ef ,
Eio_Done_Cb done_cb ,
Eio_Eet_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Sync content of an eet file handle , flushing pending writes asynchronously .
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle .
* @ param done_cb Callback called from the main loop when the file has been synced .
* @ param error_cb Callback called in the main loop when the file can ' t be synced .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*
2013-01-02 16:39:18 -08:00
* This function will call eet_sync ( ) from another thread . As long as the done_cb or
2012-03-01 19:36:28 -08:00
* error_cb haven ' t be called , you must keep @ p ef open .
2012-02-22 08:30:43 -08:00
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_sync ( Eet_File * ef ,
Eio_Done_Cb done_cb ,
Eio_Eet_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Write a data structure from memory and store in an eet file
2012-03-01 19:36:28 -08:00
* using a cipher asynchronously .
2012-02-22 08:30:43 -08:00
* @ param ef The eet file handle to write to .
* @ param edd The data descriptor to use when encoding .
* @ param name The key to store the data under in the eet file .
* @ param cipher_key The key to use as cipher .
2012-03-01 19:36:28 -08:00
* @ param write_data A pointer to the data structure to save and encode .
2012-02-22 08:30:43 -08:00
* @ param compress Compression flags for storage .
* @ param done_cb Callback called from the main loop when the data has been put in the Eet_File .
* @ param error_cb Callback called in the main loop when the file can ' t be written .
* @ param user_data Private data given to each callback .
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_data_write_cipher ( Eet_File * ef ,
Eet_Data_Descriptor * edd ,
const char * name ,
const char * cipher_key ,
void * write_data ,
int compress ,
Eio_Done_Int_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * user_data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Read a data structure from an eet file and decodes it using a cipher asynchronously .
2012-02-22 08:30:43 -08:00
* @ param ef The eet file handle to read from .
* @ param edd The data descriptor handle to use when decoding .
* @ param name The key the data is stored under in the eet file .
* @ param cipher_key The key to use as cipher .
* @ param done_cb Callback called from the main loop when the data has been read and decoded .
* @ param error_cb Callback called in the main loop when the data can ' t be read .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_data_read_cipher ( Eet_File * ef ,
Eet_Data_Descriptor * edd ,
const char * name ,
const char * cipher_key ,
Eio_Done_ERead_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Write image data to the named key in an eet file asynchronously .
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle opened for writing .
* @ param name Name of the entry . eg : " /base/file_i_want " .
* @ param cipher_key The key to use as cipher .
* @ param write_data A pointer to the image pixel data .
* @ param w The width of the image in pixels .
* @ param h The height of the image in pixels .
* @ param alpha The alpha channel flag .
* @ param compress The compression amount .
* @ param quality The quality encoding amount .
* @ param lossy The lossiness flag .
* @ param done_cb Callback called from the main loop when the data has been put in the Eet_File .
* @ param error_cb Callback called in the main loop when the file can ' t be written .
* @ param user_data Private data given to each callback .
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_data_image_write_cipher ( Eet_File * ef ,
const char * name ,
const char * cipher_key ,
void * write_data ,
unsigned int w ,
unsigned int h ,
int alpha ,
int compress ,
int quality ,
int lossy ,
Eio_Done_Int_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * user_data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Read a specified entry from an eet file and return data
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle opened for reading .
* @ param name Name of the entry . eg : " /base/file_i_want " .
* @ param done_cb Callback called from the main loop when the data has been read .
* @ param error_cb Callback called in the main loop when the data can ' t be read .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_read_direct ( Eet_File * ef ,
const char * name ,
Eio_Done_Data_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Read a specified entry from an eet file and return data
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle opened for reading .
* @ param name Name of the entry . eg : " /base/file_i_want " .
* @ param cipher_key The key to use as cipher .
* @ param done_cb Callback called from the main loop when the data has been read .
* @ param error_cb Callback called in the main loop when the data can ' t be read .
2012-03-01 19:36:28 -08:00
* @ param data Unmodified user data passed to callbacks
2012-02-22 08:30:43 -08:00
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_read_cipher ( Eet_File * ef ,
const char * name ,
const char * cipher_key ,
Eio_Done_Read_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * data ) ;
2012-02-22 08:30:43 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Write a specified entry to an eet file handle using a cipher .
2012-02-22 08:30:43 -08:00
* @ param ef A valid eet file handle opened for writing .
* @ param name Name of the entry . eg : " /base/file_i_want " .
* @ param write_data Pointer to the data to be stored .
* @ param size Length in bytes in the data to be stored .
* @ param compress Compression flags ( 1 = = compress , 0 = don ' t compress ) .
* @ param cipher_key The key to use as cipher .
* @ param done_cb Callback called from the main loop when the data has been put in the Eet_File .
* @ param error_cb Callback called in the main loop when the file can ' t be written .
* @ param user_data Private data given to each callback .
* @ return NULL in case of a failure .
*/
2012-02-21 13:01:22 -08:00
EAPI Eio_File * eio_eet_write_cipher ( Eet_File * ef ,
const char * name ,
void * write_data ,
int size ,
int compress ,
const char * cipher_key ,
Eio_Done_Int_Cb done_cb ,
Eio_Error_Cb error_cb ,
const void * user_data ) ;
/**
* @ }
*/
2011-04-25 10:04:46 -07:00
/**
* @ defgroup Eio_Monitor Eio file and directory monitoring API
2012-12-28 12:47:25 -08:00
* @ ingroup Eio
2011-04-25 10:04:46 -07:00
*
2012-03-01 19:36:28 -08:00
* @ brief These function monitor changes in directories and files
2011-04-25 10:04:46 -07:00
*
2012-03-01 19:36:28 -08:00
* These functions use the best available method to monitor changes on a specified directory
* or file . They send ecore events when changes occur , and they maintain internal refcounts to
* reduce resource consumption on duplicate monitor targets .
2011-04-25 10:04:46 -07:00
*
* @ {
*/
2012-03-01 19:36:28 -08:00
EAPI extern int EIO_MONITOR_FILE_CREATED ; /**< A new file was created in a watched directory */
2012-09-05 00:19:30 -07:00
EAPI extern int EIO_MONITOR_FILE_DELETED ; /**< A watched file was deleted, or a file in a watched directory was deleted */
2012-03-01 19:36:28 -08:00
EAPI extern int EIO_MONITOR_FILE_MODIFIED ; /**< A file was modified in a watched directory */
2015-02-26 05:37:45 -08:00
EAPI extern int EIO_MONITOR_FILE_CLOSED ; /**< A file was closed in a watched directory. This event is never sent on Windows and OSX */
2012-03-01 19:36:28 -08:00
EAPI extern int EIO_MONITOR_DIRECTORY_CREATED ; /**< A new directory was created in a watched directory */
EAPI extern int EIO_MONITOR_DIRECTORY_DELETED ; /**< A directory has been deleted: this can be either a watched directory or one of its subdirectories */
EAPI extern int EIO_MONITOR_DIRECTORY_MODIFIED ; /**< A directory has been modified in a watched directory */
2015-02-26 05:37:45 -08:00
EAPI extern int EIO_MONITOR_DIRECTORY_CLOSED ; /**< A directory has been closed in a watched directory. This event is never sent on Windows and OSX */
EAPI extern int EIO_MONITOR_SELF_RENAME ; /**< The monitored path has been renamed, an error could happen just after if the renamed path doesn't exist. This event is never sent on OSX */
EAPI extern int EIO_MONITOR_SELF_DELETED ; /**< The monitored path has been removed. This event is never sent on OSX */
2012-03-01 19:36:28 -08:00
EAPI extern int EIO_MONITOR_ERROR ; /**< During operation the monitor failed and will no longer work. eio_monitor_del must be called on it. */
2011-04-25 10:04:46 -07:00
typedef struct _Eio_Monitor Eio_Monitor ;
typedef struct _Eio_Monitor_Error Eio_Monitor_Error ;
2011-04-27 03:27:07 -07:00
typedef struct _Eio_Monitor_Event Eio_Monitor_Event ;
2011-04-25 10:04:46 -07:00
struct _Eio_Monitor_Error
{
Eio_Monitor * monitor ;
int error ;
} ;
2011-04-27 03:27:07 -07:00
struct _Eio_Monitor_Event
{
Eio_Monitor * monitor ;
const char * filename ;
} ;
2012-01-24 08:00:57 -08:00
/**
* @ brief Adds a file / directory to monitor ( inotify mechanism )
* @ param path file / directory to monitor
2012-06-15 12:08:03 -07:00
* @ return NULL in case of a failure or a pointer to the monitor in case of
* success .
2012-01-24 08:00:57 -08:00
*
* This function will add the given path to its internal
2012-03-01 19:36:28 -08:00
* list of files to monitor . It utilizes the inotify mechanism
* introduced in kernel 2.6 .13 for passive monitoring .
2012-01-24 08:00:57 -08:00
*/
2011-04-25 10:04:46 -07:00
EAPI Eio_Monitor * eio_monitor_add ( const char * path ) ;
2012-01-24 08:00:57 -08:00
/**
2012-06-15 12:08:03 -07:00
* @ brief Adds a file / directory to monitor
2012-01-24 08:00:57 -08:00
* @ param path file / directory to monitor
2012-06-15 12:08:03 -07:00
* @ return NULL in case of a failure or a pointer to the monitor in case of
* success .
2012-03-01 19:36:28 -08:00
* @ warning Do NOT pass non - stringshared strings to this function !
* If you don ' t know what this means , use eio_monitor_add ( ) .
2012-06-15 12:08:03 -07:00
*
* This fuction is just like eio_monitor_add ( ) , however the string passed by
* argument must be created using eina_stringshare_add ( ) .
2012-01-24 08:00:57 -08:00
*/
2011-04-25 10:04:46 -07:00
EAPI Eio_Monitor * eio_monitor_stringshared_add ( const char * path ) ;
2012-01-24 08:00:57 -08:00
/**
* @ brief Deletes a path from the “ watched ” list
2012-03-01 19:36:28 -08:00
* @ param monitor The Eio_Monitor you want to stop watching .
* It can only be an Eio_Monitor returned to you from calling
2012-01-24 08:00:57 -08:00
* eio_monitor_add ( ) or eio_monitor_stringshared_add ( )
*/
2011-04-25 10:04:46 -07:00
EAPI void eio_monitor_del ( Eio_Monitor * monitor ) ;
2012-01-24 08:00:57 -08:00
/**
* @ brief returns the path being watched by the given
* Eio_Monitor .
2012-03-01 19:36:28 -08:00
* @ param monitor Eio_Monitor to return the path of
* @ return The stringshared path belonging to @ p monitor
2012-01-24 08:00:57 -08:00
*/
2011-04-25 10:04:46 -07:00
EAPI const char * eio_monitor_path_get ( Eio_Monitor * monitor ) ;
2010-10-12 07:59:30 -07:00
/**
* @ }
*/
2010-10-29 05:58:04 -07:00
# include "eio_inline_helper.x"
2010-10-12 07:59:30 -07:00
# ifdef __cplusplus
}
# endif
2015-04-28 06:12:42 -07:00
# undef EAPI
# define EAPI
2010-10-12 07:59:30 -07:00
2010-07-22 09:08:17 -07:00
# endif