summaryrefslogtreecommitdiff
path: root/src/lib/eio/Eio.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/eio/Eio.h')
-rw-r--r--src/lib/eio/Eio.h1190
1 files changed, 1190 insertions, 0 deletions
diff --git a/src/lib/eio/Eio.h b/src/lib/eio/Eio.h
new file mode 100644
index 0000000..cb791a0
--- /dev/null
+++ b/src/lib/eio/Eio.h
@@ -0,0 +1,1190 @@
1/* EIO - EFL data type library
2 * Copyright (C) 2010 Enlightenment Developers:
3 * Cedric Bail <cedric.bail@free.fr>
4 * Vincent "caro" Torri <vtorri at univ-evry dot fr>
5 * Stephen "okra" Houston <unixtitan@gmail.com>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library;
19 * if not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef EIO_H__
23# define EIO_H__
24
25#include <sys/types.h>
26#include <sys/stat.h>
27#include <unistd.h>
28
29#include <Eina.h>
30#include <Eet.h>
31
32#ifdef EAPI
33# undef EAPI
34#endif
35
36#ifdef _WIN32
37# ifdef EFL_EIO_BUILD
38# ifdef DLL_EXPORT
39# define EAPI __declspec(dllexport)
40# else
41# define EAPI
42# endif /* ! DLL_EXPORT */
43# else
44# define EAPI __declspec(dllimport)
45# endif /* ! EFL_EIO_BUILD */
46#else
47# ifdef __GNUC__
48# if __GNUC__ >= 4
49# define EAPI __attribute__ ((visibility("default")))
50# else
51# define EAPI
52# endif
53# else
54# define EAPI
55# endif
56#endif /* ! _WIN32 */
57
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63#define EIO_VERSION_MAJOR 1
64#define EIO_VERSION_MINOR 8
65
66 /**
67 * @typedef Eio_Version
68 * Represents the current version of EIO
69 */
70 typedef struct _Eio_Version
71 {
72 int major; /**< Major version number */
73 int minor; /**< Minor version number */
74 int micro; /**< Micro version number */
75 int revision; /**< Revision number */
76 } Eio_Version;
77
78 EAPI extern Eio_Version *eio_version;
79
80/**
81 * @defgroup Eio_Group Eio Reference API
82 *
83 * @brief This is the core asynchronous input/output operation
84 *
85 * All the functions in this group perform input/output operations
86 * in a separate thread using the infrastructure provided by
87 * Ecore_Thread and Eina, this means that all functions here are non-blocking.
88 *
89 * The functions displayed here are used to make basic file operations, like
90 * listing the content of a directory, creating a new directory, etc.
91 *
92 * @{
93 */
94
95/**
96 * @enum _Eio_File_Op
97 *
98 * @brief Input/Output operations on files.
99 *
100 * This enum represents the operations that can be done.
101 */
102enum _Eio_File_Op
103{
104 EIO_FILE_COPY, /**< I/O operation is about a specific file copy */
105 EIO_FILE_MOVE, /**< I/O operation is about a specific file move */
106 EIO_DIR_COPY, /**< I/O operation is about a specific directory copy */
107 EIO_DIR_MOVE, /**< I/O operation is about a specific directory move */
108 /** I/O operation is about destroying a path:
109 * source will point to base path to be destroyed,
110 * and dest will point to to path destroyed by this I/O
111 */
112 EIO_UNLINK,
113 EIO_FILE_GETPWNAM, /**< I/O operation is trying to get uid from user name */
114 EIO_FILE_GETGRNAM /**< I/O operation is trying to get gid from user name */
115};
116
117/**
118 * @typedef Eio_File_Op
119 * Input/Output operations on files.
120 */
121typedef enum _Eio_File_Op Eio_File_Op;
122
123/**
124 * @typedef Eio_File
125 * Generic asynchronous I/O reference.
126 */
127typedef struct _Eio_File Eio_File;
128
129/**
130 * @typedef Eio_Progress
131 * Progress information on a specific operation.
132 */
133typedef struct _Eio_Progress Eio_Progress;
134
135typedef Eina_Bool (*Eio_Filter_Cb)(void *data, Eio_File *handler, const char *file);
136typedef void (*Eio_Main_Cb)(void *data, Eio_File *handler, const char *file);
137
138typedef Eina_Bool (*Eio_Filter_Direct_Cb)(void *data, Eio_File *handler, const Eina_File_Direct_Info *info);
139typedef Eina_Bool (*Eio_Filter_Dir_Cb)(void *data, Eio_File *handler, Eina_File_Direct_Info *info);
140typedef void (*Eio_Main_Direct_Cb)(void *data, Eio_File *handler, const Eina_File_Direct_Info *info);
141
142typedef void (*Eio_Stat_Cb)(void *data, Eio_File *handler, const Eina_Stat *stat);
143typedef void (*Eio_Progress_Cb)(void *data, Eio_File *handler, const Eio_Progress *info);
144
145typedef void (*Eio_Eet_Open_Cb)(void *data, Eio_File *handler, Eet_File *file);
146typedef void (*Eio_Open_Cb)(void *data, Eio_File *handler, Eina_File *file);
147typedef Eina_Bool (*Eio_Filter_Map_Cb)(void *data, Eio_File *handler, void *map, size_t length);
148typedef void (*Eio_Map_Cb)(void *data, Eio_File *handler, void *map, size_t length);
149
150typedef void (*Eio_Done_Data_Cb)(void *data, Eio_File *handler, const char *read_data, unsigned int size);
151typedef void (*Eio_Done_String_Cb)(void *data, Eio_File *handler, const char *xattr_string);
152typedef void (*Eio_Done_Double_Cb)(void *data, Eio_File *handler, double xattr_double);
153typedef void (*Eio_Done_Int_Cb)(void *data, Eio_File *handler, int i);
154
155typedef void (*Eio_Done_ERead_Cb)(void *data, Eio_File *handler, void *decoded);
156typedef void (*Eio_Done_Read_Cb)(void *data, Eio_File *handler, void *read_data, unsigned int size);
157typedef void (*Eio_Done_Cb)(void *data, Eio_File *handler);
158typedef void (*Eio_Error_Cb)(void *data, Eio_File *handler, int error);
159typedef void (*Eio_Eet_Error_Cb)(void *data, Eio_File *handler, Eet_Error err);
160
161/**
162 * @struct _Eio_Progress
163 * @brief Represents the current progress of the operation.
164 */
165struct _Eio_Progress
166{
167 Eio_File_Op op; /**< I/O type */
168
169 long long current; /**< Current step in the I/O operation */
170 long long max; /**< Number of total steps to complete this I/O */
171 float percent; /**< Percent done for the I/O operation */
172
173 const char *source; /**< source of the I/O operation */
174 const char *dest; /**< target of the I/O operation */
175};
176
177/**
178 * @brief List contents of a directory without locking your app.
179 * @param dir The directory to list.
180 * @param filter_cb Callback used to decide if the file will be passed to main_cb
181 * @param main_cb Callback called for each listed file if it was not filtered.
182 * @param done_cb Callback called when the ls operation is done.
183 * @param error_cb Callback called when either the directory could not be opened or the operation has been canceled.
184 * @param data Unmodified user data passed to callbacks
185 * @return A reference to the I/O operation.
186 *
187 * This function is responsible for listing the content of a directory without blocking your application.
188 * It's equivalent to the "ls" shell command. Every file will be passed to the
189 * filter_cb, so it's your job to decide if you want to pass the file to the
190 * main_cb or not. Return EINA_TRUE to pass it to the main_cb or EINA_FALSE to
191 * ignore it.
192 */
193EAPI Eio_File *eio_file_ls(const char *dir,
194 Eio_Filter_Cb filter_cb,
195 Eio_Main_Cb main_cb,
196 Eio_Done_Cb done_cb,
197 Eio_Error_Cb error_cb,
198 const void *data);
199
200/**
201 * @brief List contents of a directory without locking your app.
202 * @param dir The directory to list.
203 * @param filter_cb Callback used to decide if the file will be passed to main_cb
204 * @param main_cb Callback called from the main loop for each accepted file (not filtered).
205 * @param done_cb Callback called from the main loop after the contents of the directory has been listed.
206 * @param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled.
207 * @param data Unmodified user data passed to callbacks
208 * @return A reference to the I/O operation.
209 *
210 * eio_file_direct_ls runs eina_file_direct_ls in a separate thread using
211 * ecore_thread_feedback_run. This prevents any blocking in your apps.
212 * Every file will be passed to the filter_cb, so it's your job to decide if you
213 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
214 * the main_cb or EINA_FALSE to ignore it.
215 */
216EAPI Eio_File *eio_file_direct_ls(const char *dir,
217 Eio_Filter_Direct_Cb filter_cb,
218 Eio_Main_Direct_Cb main_cb,
219 Eio_Done_Cb done_cb,
220 Eio_Error_Cb error_cb,
221 const void *data);
222
223/**
224 * @brief List content of a directory without locking your app.
225 * @param dir The directory to list.
226 * @param filter_cb Callback used to decide if the file will be passed to main_cb
227 * @param main_cb Callback called from the main loop for each accepted file (not filtered).
228 * @param done_cb Callback called from the main loop after the contents of the directory has been listed.
229 * @param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled.
230 * @param data Unmodified user data passed to callbacks
231 * @return A reference to the I/O operation.
232 *
233 * Every file will be passed to the filter_cb, so it's your job to decide if you
234 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
235 * the main_cb or EINA_FALSE to ignore it.
236 *
237 */
238EAPI Eio_File *eio_file_stat_ls(const char *dir,
239 Eio_Filter_Direct_Cb filter_cb,
240 Eio_Main_Direct_Cb main_cb,
241 Eio_Done_Cb done_cb,
242 Eio_Error_Cb error_cb,
243 const void *data);
244
245/**
246 * @brief List the content of a directory and all it's sub-content asynchronously
247 * @param dir The directory to list.
248 * @param filter_cb Callback used to decide if the file will be passed to main_cb
249 * @param main_cb Callback called from the main loop for each accepted file (not filtered).
250 * @param done_cb Callback called from the main loop after the contents of the directory has been listed.
251 * @param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled.
252 * @param data Unmodified user data passed to callbacks
253 * @return A reference to the I/O operation.
254 *
255 * eio_dir_stat_ls() runs eina_file_stat_ls() recursively in a separate thread using
256 * ecore_thread_feedback_run. This prevents any blocking in your apps.
257 * Every file will be passed to the
258 * filter_cb, so it's your job to decide if you want to pass the file to the
259 * main_cb or not. Return EINA_TRUE to pass it to the main_cb or EINA_FALSE to
260 * ignore it.
261 */
262EAPI Eio_File *eio_dir_stat_ls(const char *dir,
263 Eio_Filter_Direct_Cb filter_cb,
264 Eio_Main_Direct_Cb main_cb,
265 Eio_Done_Cb done_cb,
266 Eio_Error_Cb error_cb,
267 const void *data);
268
269/**
270 * @brief List the content of a directory and all it's sub-content asynchronously
271 * @param dir The directory to list.
272 * @param filter_cb Callback used to decide if the file will be passed to main_cb
273 * @param main_cb Callback called from the main loop for each accepted file (not filtered).
274 * @param done_cb Callback called from the main loop after the contents of the directory has been listed.
275 * @param error_cb Callback called from the main loop when either the directory could not be opened or the operation has been canceled.
276 * @param data Unmodified user data passed to callbacks
277 * @return A reference to the I/O operation.
278 *
279 * eio_dir_direct_ls() runs eina_file_direct_ls() recursively in a separate thread using
280 * ecore_thread_feedback_run. This prevents any blocking in your apps.
281 * Every file will be passed to the filter_cb, so it's your job to decide if you
282 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
283 * the main_cb or EINA_FALSE to ignore it.
284 */
285EAPI Eio_File *eio_dir_direct_ls(const char *dir,
286 Eio_Filter_Dir_Cb filter_cb,
287 Eio_Main_Direct_Cb main_cb,
288 Eio_Done_Cb done_cb,
289 Eio_Error_Cb error_cb,
290 const void *data);
291
292/**
293 * @brief Stat a file/directory.
294 * @param path The path to stat.
295 * @param done_cb Callback called from the main loop when stat was successfully called.
296 * @param error_cb Callback called from the main loop when stat failed or has been canceled.
297 * @param data Unmodified user data passed to callbacks
298 * @return A reference to the I/O operation.
299 *
300 * eio_file_direct_stat calls stat in another thread. This prevents any blocking in your apps.
301 */
302EAPI Eio_File *eio_file_direct_stat(const char *path,
303 Eio_Stat_Cb done_cb,
304 Eio_Error_Cb error_cb,
305 const void *data);
306
307/**
308 * @brief Change right of a path.
309 * @param path The directory path to change access right.
310 * @param mode The permission to set, follow (mode & ~umask & 0777).
311 * @param done_cb Callback called when the operation is completed.
312 * @param error_cb Callback called from if something goes wrong.
313 * @param data Unmodified user data passed to callbacks.
314 * @return A reference to the I/O operation.
315 *
316 * Set a new permission of a path changing it to the mode passed as argument.
317 * It's equivalent to the chmod command.
318 */
319EAPI Eio_File *eio_file_chmod(const char *path,
320 mode_t mode,
321 Eio_Done_Cb done_cb,
322 Eio_Error_Cb error_cb,
323 const void *data);
324
325/**
326 * @brief Change owner of a path.
327 * @param path The directory path to change owner.
328 * @param user The new user to set (can be NULL).
329 * @param group The new group to set (can be NULL).
330 * @param done_cb Callback called when the operation is completed.
331 * @param error_cb Callback called from if something goes wrong.
332 * @param data Unmodified user data passed to callbacks
333 * @return A reference to the I/O operation.
334 *
335 * This function will change the owner of a path, setting it to the user and
336 * group passed as argument. It's equivalent to the chown shell command.
337 */
338EAPI Eio_File *eio_file_chown(const char *path,
339 const char *user,
340 const char *group,
341 Eio_Done_Cb done_cb,
342 Eio_Error_Cb error_cb,
343 const void *data);
344
345/**
346 * @brief Unlink a file/directory.
347 * @param path The path to unlink.
348 * @param done_cb Callback called when the operation is completed.
349 * @param error_cb Callback called from if something goes wrong.
350 * @param data Unmodified user data passed to callbacks.
351 * @return A reference to the I/O operation.
352 *
353 * This function will erase a file.
354 */
355EAPI Eio_File *eio_file_unlink(const char *path,
356 Eio_Done_Cb done_cb,
357 Eio_Error_Cb error_cb,
358 const void *data);
359
360/**
361 * @brief Create a new directory.
362 * @param path The directory path to create.
363 * @param mode The permission to set, follow (mode & ~umask & 0777).
364 * @param done_cb Callback called when the operation is completed.
365 * @param error_cb Callback called from if something goes wrong.
366 * @param data Unmodified user data passed to callbacks
367 * @return A reference to the I/O operation.
368 *
369 * Creates a new directory using the mode provided.
370 */
371EAPI Eio_File *eio_file_mkdir(const char *path,
372 mode_t mode,
373 Eio_Done_Cb done_cb,
374 Eio_Error_Cb error_cb,
375 const void *data);
376
377/**
378 * @brief Move a file asynchronously
379 * @param source Should be the name of the file to move the data from.
380 * @param dest Should be the name of the file to move the data to.
381 * @param progress_cb Callback called to know the progress of the move.
382 * @param done_cb Callback called when the move is done.
383 * @param error_cb Callback called when something goes wrong.
384 * @param data Unmodified user data passed to callbacks
385 *
386 * This function will copy a file from source to dest. It will try to use splice
387 * if possible, if not it will fallback to mmap/write. It will try to preserve
388 * access right, but not user/group identification.
389 */
390EAPI Eio_File *eio_file_move(const char *source,
391 const char *dest,
392 Eio_Progress_Cb progress_cb,
393 Eio_Done_Cb done_cb,
394 Eio_Error_Cb error_cb,
395 const void *data);
396
397/**
398 * @brief Copy a file asynchronously
399 * @param source Should be the name of the file to copy the data from.
400 * @param dest Should be the name of the file to copy the data to.
401 * @param progress_cb Callback called to know the progress of the copy.
402 * @param done_cb Callback called when the copy is done.
403 * @param error_cb Callback called when something goes wrong.
404 * @param data Unmodified user data passed to callbacks
405 *
406 * This function will copy a file from source to dest. It will try to use splice
407 * if possible, if not it will fallback to mmap/write. It will try to preserve
408 * access right, but not user/group identification.
409 */
410EAPI Eio_File *eio_file_copy(const char *source,
411 const char *dest,
412 Eio_Progress_Cb progress_cb,
413 Eio_Done_Cb done_cb,
414 Eio_Error_Cb error_cb,
415 const void *data);
416
417/**
418 * @brief Move a directory and it's content asynchronously
419 * @param source Should be the name of the directory to copy the data from.
420 * @param dest Should be the name of the directory to copy the data to.
421 * @param filter_cb Possible to deny the move of some files/directories.
422 * @param progress_cb Callback called to know the progress of the copy.
423 * @param done_cb Callback called when the copy is done.
424 * @param error_cb Callback called when something goes wrong.
425 * @param data Unmodified user data passed to callbacks
426 *
427 * This function will move a directory and all it's content from source to dest.
428 * It will try first to rename the directory, if not it will try to use splice
429 * if possible, if not it will fallback to mmap/write.
430 * It will try to preserve access right, but not user/group identity.
431 * Every file will be passed to the filter_cb, so it's your job to decide if you
432 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
433 * the main_cb or EINA_FALSE to ignore it.
434 *
435 * @note if a rename occur, the filter callback will not be called.
436 */
437EAPI Eio_File *eio_dir_move(const char *source,
438 const char *dest,
439 Eio_Filter_Direct_Cb filter_cb,
440 Eio_Progress_Cb progress_cb,
441 Eio_Done_Cb done_cb,
442 Eio_Error_Cb error_cb,
443 const void *data);
444
445/**
446 * @brief Copy a directory and it's content asynchronously
447 * @param source Should be the name of the directory to copy the data from.
448 * @param dest Should be the name of the directory to copy the data to.
449 * @param filter_cb Possible to deny the move of some files/directories.
450 * @param progress_cb Callback called to know the progress of the copy.
451 * @param done_cb Callback called when the copy is done.
452 * @param error_cb Callback called when something goes wrong.
453 * @param data Unmodified user data passed to callbacks
454 *
455 * This function will copy a directory and all it's content from source to dest.
456 * It will try to use splice if possible, if not it will fallback to mmap/write.
457 * It will try to preserve access right, but not user/group identity.
458 * Every file will be passed to the filter_cb, so it's your job to decide if you
459 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
460 * the main_cb or EINA_FALSE to ignore it.
461 */
462EAPI Eio_File *eio_dir_copy(const char *source,
463 const char *dest,
464 Eio_Filter_Direct_Cb filter_cb,
465 Eio_Progress_Cb progress_cb,
466 Eio_Done_Cb done_cb,
467 Eio_Error_Cb error_cb,
468 const void *data);
469
470/**
471 * @brief Remove a directory and it's content asynchronously
472 * @param path Should be the name of the directory to destroy.
473 * @param filter_cb Possible to deny the move of some files/directories.
474 * @param progress_cb Callback called to know the progress of the copy.
475 * @param done_cb Callback called when the copy is done.
476 * @param error_cb Callback called when something goes wrong.
477 * @param data Unmodified user data passed to callbacks
478 *
479 * This function will remove a directory and all it's content.
480 * Every file will be passed to the filter_cb, so it's your job to decide if you
481 * want to pass the file to the main_cb or not. Return EINA_TRUE to pass it to
482 * the main_cb or EINA_FALSE to ignore it.
483 */
484EAPI Eio_File *eio_dir_unlink(const char *path,
485 Eio_Filter_Direct_Cb filter_cb,
486 Eio_Progress_Cb progress_cb,
487 Eio_Done_Cb done_cb,
488 Eio_Error_Cb error_cb,
489 const void *data);
490/**
491 * @}
492 */
493
494
495/**
496 * @defgroup Eio_Xattr Eio manipulation of eXtended attribute.
497 *
498 * @brief A set of function to manipulate data associated with a specific file
499 *
500 * The functions provided by this API are responsible to manage Extended
501 * attribute files. Like file authors, character encoding, checksum, etc.
502 * @{
503 */
504
505/**
506 * @brief Assynchronously list all eXtended attribute
507 * @param path The path to get the eXtended attribute from.
508 * @param filter_cb Callback called in the thread to validate the eXtended attribute.
509 * @param main_cb Callback called in the main loop for each accepted eXtended attribute.
510 * @param done_cb Callback called in the main loop when the all the eXtended attribute have been listed.
511 * @param error_cb Callback called in the main loop when something goes wrong during the listing of the eXtended attribute.
512 * @param data Unmodified user data passed to callbacks
513 * @return A reference to the I/O operation.
514 */
515EAPI Eio_File *eio_file_xattr(const char *path,
516 Eio_Filter_Cb filter_cb,
517 Eio_Main_Cb main_cb,
518 Eio_Done_Cb done_cb,
519 Eio_Error_Cb error_cb,
520 const void *data);
521
522/**
523 * @brief Define an extented attribute on a file/directory.
524 * @param path The path to set the attribute on.
525 * @param attribute The name of the attribute to define.
526 * @param xattr_int The value to link the attribute with.
527 * @param flags Wether to insert, replace or create the attribute.
528 * @param done_cb The callback called from the main loop when setxattr succeeded.
529 * @param error_cb The callback called from the main loop when setxattr failed.
530 * @param data Unmodified user data passed to callbacks
531 * @return A reference to the I/O operation.
532 *
533 * eio_file_xattr_int_set calls eina_xattr_int_set from another thread. This prevents blocking in your apps. If
534 * the writing succeeded, the done_cb will be called even if a cancel was requested, but came to late.
535 */
536EAPI Eio_File *eio_file_xattr_int_set(const char *path,
537 const char *attribute,
538 int xattr_int,
539 Eina_Xattr_Flags flags,
540 Eio_Done_Cb done_cb,
541 Eio_Error_Cb error_cb,
542 const void *data);
543
544/**
545 * @brief Define an extented attribute on a file/directory.
546 * @param path The path to set the attribute on.
547 * @param attribute The name of the attribute to define.
548 * @param xattr_double The value to link the attribute with.
549 * @param flags Wether to insert, replace or create the attribute.
550 * @param done_cb The callback called from the main loop when setxattr succeeded.
551 * @param error_cb The callback called from the main loop when setxattr failed.
552 * @param data Unmodified user data passed to callbacks
553 * @return A reference to the I/O operation.
554 *
555 * eio_file_xattr_double_set calls eina_xattr_double_set from another thread. This prevents blocking in your apps. If
556 * the writing succeeded, the done_cb will be called even if a cancel was requested, but came to late.
557 */
558EAPI Eio_File *eio_file_xattr_double_set(const char *path,
559 const char *attribute,
560 double xattr_double,
561 Eina_Xattr_Flags flags,
562 Eio_Done_Cb done_cb,
563 Eio_Error_Cb error_cb,
564 const void *data);
565/**
566 * @brief Define a string extented attribute on a file/directory.
567 * @param path The path to set the attribute on.
568 * @param attribute The name of the attribute to define.
569 * @param xattr_string The string to link the attribute with.
570 * @param flags Wether to insert, replace or create the attribute.
571 * @param done_cb The callback called from the main loop when setxattr succeeded.
572 * @param error_cb The callback called from the main loop when setxattr failed.
573 * @param data Unmodified user data passed to callbacks
574 * @return A reference to the I/O operation.
575 *
576 * eio_file_xattr_string_set calls eina_xattr_string_set from another thread. This prevents blocking in your apps. If
577 * the writing succeeded, the done_cb will be called even if a cancel was requested, but came to late.
578 */
579EAPI Eio_File *eio_file_xattr_string_set(const char *path,
580 const char *attribute,
581 const char *xattr_string,
582 Eina_Xattr_Flags flags,
583 Eio_Done_Cb done_cb,
584 Eio_Error_Cb error_cb,
585 const void *data);
586/**
587 * @brief Define an extented attribute on a file/directory.
588 * @param path The path to set the attribute on.
589 * @param attribute The name of the attribute to define.
590 * @param xattr_data The data to link the attribute with.
591 * @param xattr_size The size of the data to set.
592 * @param flags Wether to insert, replace or create the attribute.
593 * @param done_cb The callback called from the main loop when setxattr succeeded.
594 * @param error_cb The callback called from the main loop when setxattr failed.
595 * @param data Unmodified user data passed to callbacks
596 * @return A reference to the I/O operation.
597 *
598 * eio_file_xattr_set calls setxattr from another thread. This prevents blocking in your apps. If
599 * the writing succeeded, the done_cb will be called even if a cancel was requested, but came to late.
600 */
601EAPI Eio_File *eio_file_xattr_set(const char *path,
602 const char *attribute,
603 const char *xattr_data,
604 unsigned int xattr_size,
605 Eina_Xattr_Flags flags,
606 Eio_Done_Cb done_cb,
607 Eio_Error_Cb error_cb,
608 const void *data);
609
610/**
611 * @brief Retrieve the extended attribute of a file/directory.
612 * @param path The path to retrieve the extended attribute from.
613 * @param attribute The name of the attribute to retrieve.
614 * @param done_cb Callback called from the main loop when getxattr succeeded.
615 * @param error_cb Callback called from the main loop when getxattr failed or has been canceled.
616 * @param data Unmodified user data passed to callbacks
617 * @return A reference to the I/O operation.
618 *
619 * eio_file_xattr_get calls getxattr from another thread. This prevents blocking in your apps.
620 */
621EAPI Eio_File *eio_file_xattr_get(const char *path,
622 const char *attribute,
623 Eio_Done_Data_Cb done_cb,
624 Eio_Error_Cb error_cb,
625 const void *data);
626/**
627 * @brief Retrieve a extended attribute of a file/directory.
628 * @param path The path to retrieve the extended attribute from.
629 * @param attribute The name of the attribute to retrieve.
630 * @param done_cb Callback called from the main loop when getxattr succeeded.
631 * @param error_cb Callback called from the main loop when getxattr failed or has been canceled.
632 * @param data Unmodified user data passed to callbacks
633 * @return A reference to the I/O operation.
634 *
635 * eio_file_xattr_int_get calls eina_xattr_int_get from another thread. This prevents blocking in your apps.
636 */
637EAPI Eio_File *eio_file_xattr_int_get(const char *path,
638 const char *attribute,
639 Eio_Done_Int_Cb done_cb,
640 Eio_Error_Cb error_cb,
641 const void *data);
642/**
643 * @brief Retrieve a extended attribute of a file/directory.
644 * @param path The path to retrieve the extended attribute from.
645 * @param attribute The name of the attribute to retrieve.
646 * @param done_cb Callback called from the main loop when getxattr succeeded.
647 * @param error_cb Callback called from the main loop when getxattr failed or has been canceled.
648 * @param data Unmodified user data passed to callbacks
649 * @return A reference to the I/O operation.
650 *
651 * eio_file_xattr_double_get calls eina_xattr_double_get from another thread. This prevents blocking in your apps.
652 */
653EAPI Eio_File *eio_file_xattr_double_get(const char *path,
654 const char *attribute,
655 Eio_Done_Double_Cb done_cb,
656 Eio_Error_Cb error_cb,
657 const void *data);
658/**
659 * @brief Retrieve a string extended attribute of a file/directory.
660 * @param path The path to retrieve the extended attribute from.
661 * @param attribute The name of the attribute to retrieve.
662 * @param done_cb Callback called from the main loop when getxattr succeeded.
663 * @param error_cb Callback called from the main loop when getxattr failed or has been canceled.
664 * @param data Unmodified user data passed to callbacks
665 * @return A reference to the I/O operation.
666 *
667 * eio_file_xattr_string_get calls eina_xattr_string_get from another thread. This prevents blocking in your apps.
668 */
669EAPI Eio_File *eio_file_xattr_string_get(const char *path,
670 const char *attribute,
671 Eio_Done_String_Cb done_cb,
672 Eio_Error_Cb error_cb,
673 const void *data);
674
675/**
676 * @}
677 */
678
679/**
680 * @defgroup Eio_Helper Eio Reference helper API
681 *
682 * @brief This are helper provided around core Eio API.
683 *
684 * This set of functions do provide helper to work around data
685 * provided by Eio without the need to look at system header.
686 *
687 * @{
688 */
689
690
691/**
692 * @brief Initialize eio and all it's required submodule.
693 * @return the current number of eio users.
694 */
695EAPI int eio_init(void);
696
697/**
698 * @brief Shutdown eio and all it's submodule if possible.
699 * @return the number of pending users of eio.
700 */
701EAPI int eio_shutdown(void);
702
703/**
704 * @brief Return the container during EIO operation
705 * @param ls The asynchronous I/O operation to retrieve container from.
706 * @return NULL if not available, a DIRP if it is.
707 *
708 * This is only available and make sense in the thread callback, not in
709 * the mainloop.
710 */
711EAPI void *eio_file_container_get(Eio_File *ls);
712
713/**
714 * @brief Cancel any Eio_File.
715 * @param ls The asynchronous I/O operation to cancel.
716 * @return EINA_FALSE if the destruction is delayed, EINA_TRUE if it's done.
717 *
718 * This will cancel any kind of I/O operation and cleanup the mess. This means
719 * that it could take time to cancel an I/O.
720 */
721EAPI Eina_Bool eio_file_cancel(Eio_File *ls);
722
723/**
724 * @brief Check if an Eio_File operation has been cancelled.
725 * @param ls The asynchronous I/O operation to check.
726 * @return EINA_TRUE if it was canceled, EINA_FALSE other wise.
727 *
728 * In case of an error it also return EINA_TRUE.
729 */
730EAPI Eina_Bool eio_file_check(Eio_File *ls);
731
732/**
733 * @brief Associate data with the current filtered file.
734 * @param ls The Eio_File ls request currently calling the filter callback.
735 * @param key The key to associate data to.
736 * @param data The data to associate the data to.
737 * @param free_cb Optionally a function to call to free the associated data,
738 * @p data is passed as the callback data parameter. If no @free_cb is provided
739 * the user @p data remains untouched.
740 * @return EINA_TRUE if insertion was fine.
741 *
742 * This function can only be safely called from within the filter callback.
743 * If you don't need to copy the key around you can use @ref eio_file_associate_direct_add
744 */
745EAPI Eina_Bool eio_file_associate_add(Eio_File *ls,
746 const char *key,
747 const void *data, Eina_Free_Cb free_cb);
748
749/**
750 * @brief Associate data with the current filtered file.
751 * @param ls The Eio_File ls request currently calling the filter callback.
752 * @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).
753 * @param data The data to associate the data to.
754 * @param free_cb The function to call to free the associated data, @p free will be called if not specified.
755 * @return EINA_TRUE if insertion was fine.
756 *
757 * This function can only be safely called from within the filter callback.
758 * If you need eio to make a proper copy of the @p key to be safe use
759 * @ref eio_file_associate_add instead.
760 */
761EAPI Eina_Bool eio_file_associate_direct_add(Eio_File *ls,
762 const char *key,
763 const void *data, Eina_Free_Cb free_cb);
764
765/**
766 * @brief Get the data associated during the filter callback inside the main loop
767 * @param ls The Eio_File ls request currently calling the notify callback.
768 * @param key The key pointing to the data to retrieve.
769 * @return the data associated with the key or @p NULL if not found.
770 */
771EAPI void *eio_file_associate_find(Eio_File *ls, const char *key);
772
773/**
774 * @brief get access time from a Eina_Stat
775 * @param stat the structure to get the atime from
776 * @return the last accessed time
777 *
778 * This take care of doing type conversion to match rest of EFL time API.
779 * @note some filesystem don't update that information.
780 */
781static inline double eio_file_atime(const Eina_Stat *stat);
782
783/**
784 * @brief get modification time from a Eina_Stat
785 * @param stat the structure to get the mtime from
786 * @return the last modification time
787 *
788 * This take care of doing type conversion to match rest of EFL time API.
789 */
790static inline double eio_file_mtime(const Eina_Stat *stat);
791
792/**
793 * @brief get the size of the file described in Eina_Stat
794 * @param stat the structure to get the size from
795 * @return the size of the file
796 */
797static inline long long eio_file_size(const Eina_Stat *stat);
798
799/**
800 * @brief tell if the stated path was a directory or not.
801 * @param stat the structure to get the size from
802 * @return EINA_TRUE, if it was.
803 */
804static inline Eina_Bool eio_file_is_dir(const Eina_Stat *stat);
805
806/**
807 * @brief tell if the stated path was a link or not.
808 * @param stat the structure to get the size from
809 * @return EINA_TRUE, if it was.
810 */
811static inline Eina_Bool eio_file_is_lnk(const Eina_Stat *stat);
812
813/**
814 * @}
815 */
816
817/**
818 *
819 */
820
821/**
822 * @defgroup Eio_Map Manipulate an Eina_File asynchronously
823 *
824 * @brief This function help manipulating file asynchronously.
825 *
826 * This set of function work on top of Eina_File and Ecore_Thread to
827 * do basic operations in a file, like openning, closing and mapping a file to
828 * memory.
829 * @{
830 */
831
832/**
833 * @brief Assynchronously open a file.
834 * @param name The file to open.
835 * @param shared If it's a shared memory file.
836 * @param open_cb Callback called in the main loop when the file has been successfully opened.
837 * @param error_cb Callback called in the main loop when the file couldn't be opened.
838 * @param data Unmodified user data passed to callbacks
839 * @return Pointer to the file if successfull or NULL otherwise.
840 *
841 */
842EAPI Eio_File *eio_file_open(const char *name, Eina_Bool shared,
843 Eio_Open_Cb open_cb,
844 Eio_Error_Cb error_cb,
845 const void *data);
846
847/**
848 * @brief Assynchronously close a file.
849 * @param f The file to close.
850 * @param done_cb Callback called in the main loop when the file has been successfully closed.
851 * @param error_cb Callback called in the main loop when the file couldn't be closed.
852 * @param data Unmodified user data passed to callbacks
853 * @return Pointer to the file if successfull or NULL otherwise.
854 */
855EAPI Eio_File *eio_file_close(Eina_File *f,
856 Eio_Done_Cb done_cb,
857 Eio_Error_Cb error_cb,
858 const void *data);
859
860/**
861 * @brief Assynchronously map a file in memory.
862 * @param f The file to map.
863 * @param rule The rule to apply to the map.
864 * @param filter_cb Callback called in the thread to validate the content of the map.
865 * @param map_cb Callback called in the main loop when the file has been successfully mapped.
866 * @param error_cb Callback called in the main loop when the file can't be mapped.
867 * @param data Unmodified user data passed to callbacks
868 * @return Pointer to the file if successfull or NULL otherwise.
869 *
870 * The container of the Eio_File is the Eina_File.
871 */
872EAPI Eio_File *eio_file_map_all(Eina_File *f,
873 Eina_File_Populate rule,
874 Eio_Filter_Map_Cb filter_cb,
875 Eio_Map_Cb map_cb,
876 Eio_Error_Cb error_cb,
877 const void *data);
878
879/**
880 * @brief Assynchronously map a part of a file in memory.
881 * @param f The file to map.
882 * @param rule The rule to apply to the map.
883 * @param offset The offset inside the file
884 * @param length The length of the memory to map
885 * @param filter_cb Callback called in the thread to validate the content of the map.
886 * @param map_cb Callback called in the main loop when the file has been successfully mapped.
887 * @param error_cb Callback called in the main loop when the file can't be mapped.
888 * @param data Unmodified user data passed to callbacks
889 * @return Pointer to the file if successfull or NULL otherwise.
890 *
891 * The container of the Eio_File is the Eina_File.
892 */
893EAPI Eio_File *eio_file_map_new(Eina_File *f,
894 Eina_File_Populate rule,
895 unsigned long int offset,
896 unsigned long int length,
897 Eio_Filter_Map_Cb filter_cb,
898 Eio_Map_Cb map_cb,
899 Eio_Error_Cb error_cb,
900 const void *data);
901
902/**
903 * @}
904 */
905
906/**
907 * @defgroup Eio_Eet Eio asynchronous API for Eet file.
908 *
909 * @brief This set of functions help in the asynchronous use of Eet
910 *
911 * @{
912 */
913
914/**
915 * @brief Open an eet file on disk, and returns a handle to it asynchronously.
916 * @param filename The file path to the eet file. eg: @c "/tmp/file.eet".
917 * @param mode The mode for opening. Either EET_FILE_MODE_READ,
918 * EET_FILE_MODE_WRITE or EET_FILE_MODE_READ_WRITE.
919 * @param eet_cb The callback to call when the file has been successfully opened.
920 * @param error_cb Callback called in the main loop when the file can't be opened.
921 * @param data Unmodified user data passed to callbacks
922 * @return NULL in case of a failure.
923 *
924 * This function calls eet_open() from another thread using Ecore_Thread.
925 */
926EAPI Eio_File *eio_eet_open(const char *filename,
927 Eet_File_Mode mode,
928 Eio_Eet_Open_Cb eet_cb,
929 Eio_Error_Cb error_cb,
930 const void *data);
931/**
932 * @brief Close an eet file handle and flush pending writes asynchronously.
933 * @param ef A valid eet file handle.
934 * @param done_cb Callback called from the main loop when the file has been closed.
935 * @param error_cb Callback called in the main loop when the file can't be closed.
936 * @param data Unmodified user data passed to callbacks
937 * @return NULL in case of a failure.
938 *
939 * This function will call eet_close() from another thread by
940 * using Ecore_Thread. You should assume that the Eet_File is dead after this
941 * function is called.
942 */
943EAPI Eio_File *eio_eet_close(Eet_File *ef,
944 Eio_Done_Cb done_cb,
945 Eio_Eet_Error_Cb error_cb,
946 const void *data);
947
948/**
949 * @brief Sync content of an eet file handle, flushing pending writes asynchronously.
950 * @param ef A valid eet file handle.
951 * @param done_cb Callback called from the main loop when the file has been synced.
952 * @param error_cb Callback called in the main loop when the file can't be synced.
953 * @param data Unmodified user data passed to callbacks
954 * @return NULL in case of a failure.
955 *
956 * This function will call eet_flush() from another thread. As long as the done_cb or
957 * error_cb haven't be called, you must keep @p ef open.
958 */
959EAPI Eio_File *eio_eet_sync(Eet_File *ef,
960 Eio_Done_Cb done_cb,
961 Eio_Eet_Error_Cb error_cb,
962 const void *data);
963
964/**
965 * @brief Write a data structure from memory and store in an eet file
966 * using a cipher asynchronously.
967 * @param ef The eet file handle to write to.
968 * @param edd The data descriptor to use when encoding.
969 * @param name The key to store the data under in the eet file.
970 * @param cipher_key The key to use as cipher.
971 * @param write_data A pointer to the data structure to save and encode.
972 * @param compress Compression flags for storage.
973 * @param done_cb Callback called from the main loop when the data has been put in the Eet_File.
974 * @param error_cb Callback called in the main loop when the file can't be written.
975 * @param user_data Private data given to each callback.
976 * @return NULL in case of a failure.
977 */
978EAPI Eio_File *eio_eet_data_write_cipher(Eet_File *ef,
979 Eet_Data_Descriptor *edd,
980 const char *name,
981 const char *cipher_key,
982 void *write_data,
983 int compress,
984 Eio_Done_Int_Cb done_cb,
985 Eio_Error_Cb error_cb,
986 const void *user_data);
987
988/**
989 * @brief Read a data structure from an eet file and decodes it using a cipher asynchronously.
990 * @param ef The eet file handle to read from.
991 * @param edd The data descriptor handle to use when decoding.
992 * @param name The key the data is stored under in the eet file.
993 * @param cipher_key The key to use as cipher.
994 * @param done_cb Callback called from the main loop when the data has been read and decoded.
995 * @param error_cb Callback called in the main loop when the data can't be read.
996 * @param data Unmodified user data passed to callbacks
997 * @return NULL in case of a failure.
998 */
999EAPI Eio_File *eio_eet_data_read_cipher(Eet_File *ef,
1000 Eet_Data_Descriptor *edd,
1001 const char *name,
1002 const char *cipher_key,
1003 Eio_Done_ERead_Cb done_cb,
1004 Eio_Error_Cb error_cb,
1005 const void *data);
1006
1007/**
1008 * @brief Write image data to the named key in an eet file asynchronously.
1009 * @param ef A valid eet file handle opened for writing.
1010 * @param name Name of the entry. eg: "/base/file_i_want".
1011 * @param cipher_key The key to use as cipher.
1012 * @param write_data A pointer to the image pixel data.
1013 * @param w The width of the image in pixels.
1014 * @param h The height of the image in pixels.
1015 * @param alpha The alpha channel flag.
1016 * @param compress The compression amount.
1017 * @param quality The quality encoding amount.
1018 * @param lossy The lossiness flag.
1019 * @param done_cb Callback called from the main loop when the data has been put in the Eet_File.
1020 * @param error_cb Callback called in the main loop when the file can't be written.
1021 * @param user_data Private data given to each callback.
1022 * @return NULL in case of a failure.
1023 */
1024EAPI Eio_File *eio_eet_data_image_write_cipher(Eet_File *ef,
1025 const char *name,
1026 const char *cipher_key,
1027 void *write_data,
1028 unsigned int w,
1029 unsigned int h,
1030 int alpha,
1031 int compress,
1032 int quality,
1033 int lossy,
1034 Eio_Done_Int_Cb done_cb,
1035 Eio_Error_Cb error_cb,
1036 const void *user_data);
1037
1038/**
1039 * @brief Read a specified entry from an eet file and return data
1040 * @param ef A valid eet file handle opened for reading.
1041 * @param name Name of the entry. eg: "/base/file_i_want".
1042 * @param done_cb Callback called from the main loop when the data has been read.
1043 * @param error_cb Callback called in the main loop when the data can't be read.
1044 * @param data Unmodified user data passed to callbacks
1045 * @return NULL in case of a failure.
1046 */
1047EAPI Eio_File *eio_eet_read_direct(Eet_File *ef,
1048 const char *name,
1049 Eio_Done_Data_Cb done_cb,
1050 Eio_Error_Cb error_cb,
1051 const void *data);
1052
1053/**
1054 * @brief Read a specified entry from an eet file and return data
1055 * @param ef A valid eet file handle opened for reading.
1056 * @param name Name of the entry. eg: "/base/file_i_want".
1057 * @param cipher_key The key to use as cipher.
1058 * @param done_cb Callback called from the main loop when the data has been read.
1059 * @param error_cb Callback called in the main loop when the data can't be read.
1060 * @param data Unmodified user data passed to callbacks
1061 * @return NULL in case of a failure.
1062 */
1063EAPI Eio_File *eio_eet_read_cipher(Eet_File *ef,
1064 const char *name,
1065 const char *cipher_key,
1066 Eio_Done_Read_Cb done_cb,
1067 Eio_Error_Cb error_cb,
1068 const void *data);
1069
1070/**
1071 * @brief Write a specified entry to an eet file handle using a cipher.
1072 * @param ef A valid eet file handle opened for writing.
1073 * @param name Name of the entry. eg: "/base/file_i_want".
1074 * @param write_data Pointer to the data to be stored.
1075 * @param size Length in bytes in the data to be stored.
1076 * @param compress Compression flags (1 == compress, 0 = don't compress).
1077 * @param cipher_key The key to use as cipher.
1078 * @param done_cb Callback called from the main loop when the data has been put in the Eet_File.
1079 * @param error_cb Callback called in the main loop when the file can't be written.
1080 * @param user_data Private data given to each callback.
1081 * @return NULL in case of a failure.
1082 */
1083EAPI Eio_File *eio_eet_write_cipher(Eet_File *ef,
1084 const char *name,
1085 void *write_data,
1086 int size,
1087 int compress,
1088 const char *cipher_key,
1089 Eio_Done_Int_Cb done_cb,
1090 Eio_Error_Cb error_cb,
1091 const void *user_data);
1092
1093/**
1094 * @}
1095 */
1096
1097/**
1098 * @defgroup Eio_Monitor Eio file and directory monitoring API
1099 *
1100 * @brief These function monitor changes in directories and files
1101 *
1102 * These functions use the best available method to monitor changes on a specified directory
1103 * or file. They send ecore events when changes occur, and they maintain internal refcounts to
1104 * reduce resource consumption on duplicate monitor targets.
1105 *
1106 * @{
1107 */
1108
1109EAPI extern int EIO_MONITOR_FILE_CREATED; /**< A new file was created in a watched directory */
1110EAPI extern int EIO_MONITOR_FILE_DELETED; /**< A watched file was deleted, or a file in a watched directory was deleted */
1111EAPI extern int EIO_MONITOR_FILE_MODIFIED; /**< A file was modified in a watched directory */
1112EAPI extern int EIO_MONITOR_FILE_CLOSED; /**< A file was closed in a watched directory. This event is never sent on Windows */
1113EAPI extern int EIO_MONITOR_DIRECTORY_CREATED; /**< A new directory was created in a watched directory */
1114EAPI extern int EIO_MONITOR_DIRECTORY_DELETED; /**< A directory has been deleted: this can be either a watched directory or one of its subdirectories */
1115EAPI extern int EIO_MONITOR_DIRECTORY_MODIFIED; /**< A directory has been modified in a watched directory */
1116EAPI extern int EIO_MONITOR_DIRECTORY_CLOSED; /**< A directory has been closed in a watched directory. This event is never sent on Windows */
1117EAPI 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 */
1118EAPI extern int EIO_MONITOR_SELF_DELETED; /**< The monitored path has been removed */
1119EAPI extern int EIO_MONITOR_ERROR; /**< During operation the monitor failed and will no longer work. eio_monitor_del must be called on it. */
1120
1121typedef struct _Eio_Monitor Eio_Monitor;
1122
1123typedef struct _Eio_Monitor_Error Eio_Monitor_Error;
1124typedef struct _Eio_Monitor_Event Eio_Monitor_Event;
1125
1126struct _Eio_Monitor_Error
1127{
1128 Eio_Monitor *monitor;
1129 int error;
1130};
1131
1132struct _Eio_Monitor_Event
1133{
1134 Eio_Monitor *monitor;
1135 const char *filename;
1136};
1137
1138/**
1139 * @brief Adds a file/directory to monitor (inotify mechanism)
1140 * @param path file/directory to monitor
1141 * @return NULL in case of a failure or a pointer to the monitor in case of
1142 * success.
1143 *
1144 * This function will add the given path to its internal
1145 * list of files to monitor. It utilizes the inotify mechanism
1146 * introduced in kernel 2.6.13 for passive monitoring.
1147 */
1148EAPI Eio_Monitor *eio_monitor_add(const char *path);
1149
1150/**
1151 * @brief Adds a file/directory to monitor
1152 * @param path file/directory to monitor
1153 * @return NULL in case of a failure or a pointer to the monitor in case of
1154 * success.
1155 * @warning Do NOT pass non-stringshared strings to this function!
1156 * If you don't know what this means, use eio_monitor_add().
1157 *
1158 * This fuction is just like eio_monitor_add(), however the string passed by
1159 * argument must be created using eina_stringshare_add().
1160 */
1161EAPI Eio_Monitor *eio_monitor_stringshared_add(const char *path);
1162
1163/**
1164 * @brief Deletes a path from the “watched” list
1165 * @param monitor The Eio_Monitor you want to stop watching.
1166 * It can only be an Eio_Monitor returned to you from calling
1167 * eio_monitor_add() or eio_monitor_stringshared_add()
1168 */
1169EAPI void eio_monitor_del(Eio_Monitor *monitor);
1170
1171/**
1172 * @brief returns the path being watched by the given
1173 * Eio_Monitor.
1174 * @param monitor Eio_Monitor to return the path of
1175 * @return The stringshared path belonging to @p monitor
1176 */
1177EAPI const char *eio_monitor_path_get(Eio_Monitor *monitor);
1178
1179/**
1180 * @}
1181 */
1182
1183#include "eio_inline_helper.x"
1184
1185#ifdef __cplusplus
1186}
1187#endif
1188
1189
1190#endif