summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-06-16 15:13:22 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-06-22 13:19:13 -0700
commit10aadafcfd01d972a50fb9e1e6b3d3c28924feb0 (patch)
treeca3375665c23b8ba1c683c8c97695a37336f3f69 /src/lib/eio
parentae207a5be683c3f89087552a11fc7bd91128d71e (diff)
eio: rename eio_job to efl_io_manager.
There is still a lot of work to do in this API to make it efficient and stable. Will try to get at it before 1.18 release.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/Eio_Eo.h2
-rw-r--r--src/lib/eio/efl_io_manager.c (renamed from src/lib/eio/eio_job.c)87
-rw-r--r--src/lib/eio/efl_io_manager.eo (renamed from src/lib/eio/eio_job.eo)6
-rw-r--r--src/lib/eio/eio_job_private.h12
4 files changed, 54 insertions, 53 deletions
diff --git a/src/lib/eio/Eio_Eo.h b/src/lib/eio/Eio_Eo.h
index 3fe3510816..b79f2ab870 100644
--- a/src/lib/eio/Eio_Eo.h
+++ b/src/lib/eio/Eio_Eo.h
@@ -5,7 +5,7 @@
5extern "C" { 5extern "C" {
6#endif 6#endif
7 7
8#include "eio_job.eo.h" 8#include "efl_io_manager.eo.h"
9#include "eio_sentry.eo.h" 9#include "eio_sentry.eo.h"
10#include "eio_model.eo.h" 10#include "eio_model.eo.h"
11 11
diff --git a/src/lib/eio/eio_job.c b/src/lib/eio/efl_io_manager.c
index aa98ef414b..436f652085 100644
--- a/src/lib/eio/eio_job.c
+++ b/src/lib/eio/efl_io_manager.c
@@ -25,26 +25,33 @@
25 25
26#include <Eo.h> 26#include <Eo.h>
27#include "Eio.h" 27#include "Eio.h"
28#include "eio_job_private.h"
29 28
30typedef Eio_File* (*Eio_Job_Direct_Ls_Func)(const char *path, Eio_Filter_Direct_Cb, Eio_Main_Direct_Cb, Eio_Done_Cb, Eio_Error_Cb, const void *data); 29typedef struct _Efl_Io_Manager_Data Efl_Io_Manager_Data;
30
31struct _Efl_Io_Manager_Data
32{
33 Eo *object;
34 Eina_List *operations;
35};
36
37typedef Eio_File* (*Efl_Io_Manager_Direct_Ls_Func)(const char *path, Eio_Filter_Direct_Cb, Eio_Main_Direct_Cb, Eio_Done_Cb, Eio_Error_Cb, const void *data);
31 38
32typedef struct _Job_Closure Job_Closure; 39typedef struct _Job_Closure Job_Closure;
33struct _Job_Closure 40struct _Job_Closure
34{ 41{
35 Eo *object; 42 Eo *object;
36 Eio_Job_Data *pdata; 43 Efl_Io_Manager_Data *pdata;
37 Eina_Promise_Owner *promise; 44 Eina_Promise_Owner *promise;
38 Eio_File *file; 45 Eio_File *file;
39 Eina_Bool delete_me; 46 Eina_Bool delete_me;
40 void *delayed_arg; 47 void *delayed_arg;
41 Eio_Job_Direct_Ls_Func direct_func; // Used when dispatching direct ls funcs. 48 Efl_Io_Manager_Direct_Ls_Func direct_func; // Used when dispatching direct ls funcs.
42}; 49};
43 50
44/* Helper functions */ 51/* Helper functions */
45 52
46static Job_Closure * 53static Job_Closure *
47_job_closure_create(Eo *obj, Eio_Job_Data *pdata, Eina_Promise_Owner *owner) 54_job_closure_create(Eo *obj, Efl_Io_Manager_Data *pdata, Eina_Promise_Owner *owner)
48{ 55{
49 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL); 56 EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
50 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL); 57 EINA_SAFETY_ON_NULL_RETURN_VAL(pdata, NULL);
@@ -75,7 +82,7 @@ static void
75_job_closure_del(Job_Closure *closure) 82_job_closure_del(Job_Closure *closure)
76{ 83{
77 EINA_SAFETY_ON_NULL_RETURN(closure); 84 EINA_SAFETY_ON_NULL_RETURN(closure);
78 Eio_Job_Data *pdata = closure->pdata; 85 Efl_Io_Manager_Data *pdata = closure->pdata;
79 if (pdata) 86 if (pdata)
80 pdata->operations = eina_list_remove(pdata->operations, closure); 87 pdata->operations = eina_list_remove(pdata->operations, closure);
81 88
@@ -129,13 +136,13 @@ _file_ls_filter_cb_helper(const Eo_Event_Description *event, void *data, const c
129static Eina_Bool 136static Eina_Bool
130_file_ls_filter_xattr_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file) 137_file_ls_filter_xattr_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file)
131{ 138{
132 return _file_ls_filter_cb_helper(EIO_JOB_EVENT_XATTR, data, file); 139 return _file_ls_filter_cb_helper(EFL_IO_MANAGER_EVENT_XATTR, data, file);
133} 140}
134 141
135static Eina_Bool 142static Eina_Bool
136_file_ls_filter_named_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file) 143_file_ls_filter_named_cb(void *data, Eio_File *handler EINA_UNUSED, const char *file)
137{ 144{
138 return _file_ls_filter_cb_helper(EIO_JOB_EVENT_FILTER_NAME, data, file); 145 return _file_ls_filter_cb_helper(EFL_IO_MANAGER_EVENT_FILTER_NAME, data, file);
139} 146}
140 147
141static void 148static void
@@ -206,7 +213,7 @@ _file_direct_ls_filter_cb(void *data, Eio_File *handle EINA_UNUSED, const Eina_F
206 event_info.info = info; 213 event_info.info = info;
207 event_info.filter = EINA_FALSE; 214 event_info.filter = EINA_FALSE;
208 215
209 eo_event_callback_call(operation->pdata->object, EIO_JOB_EVENT_FILTER_DIRECT, &event_info); 216 eo_event_callback_call(operation->pdata->object, EFL_IO_MANAGER_EVENT_FILTER_DIRECT, &event_info);
210 217
211 Eina_Bool filter = event_info.filter; 218 Eina_Bool filter = event_info.filter;
212 219
@@ -279,9 +286,9 @@ _xattr_notify_start(void *data, Eina_Promise_Owner *promise EINA_UNUSED)
279} 286}
280 287
281static void 288static void
282_job_direct_ls_helper(Eio_Job_Direct_Ls_Func ls_func, 289_job_direct_ls_helper(Efl_Io_Manager_Direct_Ls_Func ls_func,
283 Eo* obj, 290 Eo* obj,
284 Eio_Job_Data *pd, 291 Efl_Io_Manager_Data *pd,
285 const char *path, 292 const char *path,
286 Eina_Promise_Owner *promise) 293 Eina_Promise_Owner *promise)
287{ 294{
@@ -309,8 +316,8 @@ _job_direct_ls_helper(Eio_Job_Direct_Ls_Func ls_func,
309/* Method implementations */ 316/* Method implementations */
310 317
311static Eina_Promise* 318static Eina_Promise*
312_eio_job_file_direct_ls(Eo *obj, 319_efl_io_manager_file_direct_ls(Eo *obj,
313 Eio_Job_Data *pd, 320 Efl_Io_Manager_Data *pd,
314 const char *path) 321 const char *path)
315{ 322{
316 Eina_Promise_Owner* promise = eina_promise_add(); 323 Eina_Promise_Owner* promise = eina_promise_add();
@@ -319,8 +326,8 @@ _eio_job_file_direct_ls(Eo *obj,
319} 326}
320 327
321static Eina_Promise* 328static Eina_Promise*
322_eio_job_file_stat_ls(Eo *obj, 329_efl_io_manager_file_stat_ls(Eo *obj,
323 Eio_Job_Data *pd, 330 Efl_Io_Manager_Data *pd,
324 const char *path) 331 const char *path)
325{ 332{
326 Eina_Promise_Owner* promise = eina_promise_add(); 333 Eina_Promise_Owner* promise = eina_promise_add();
@@ -329,8 +336,8 @@ _eio_job_file_stat_ls(Eo *obj,
329} 336}
330 337
331static Eina_Promise* 338static Eina_Promise*
332_eio_job_dir_stat_ls(Eo *obj, 339_efl_io_manager_dir_stat_ls(Eo *obj,
333 Eio_Job_Data *pd, 340 Efl_Io_Manager_Data *pd,
334 const char *path) 341 const char *path)
335{ 342{
336 Eina_Promise_Owner* promise = eina_promise_add(); 343 Eina_Promise_Owner* promise = eina_promise_add();
@@ -339,20 +346,20 @@ _eio_job_dir_stat_ls(Eo *obj,
339} 346}
340 347
341static Eina_Promise* 348static Eina_Promise*
342_eio_job_dir_direct_ls(Eo *obj, 349_efl_io_manager_dir_direct_ls(Eo *obj,
343 Eio_Job_Data *pd, 350 Efl_Io_Manager_Data *pd,
344 const char *path) 351 const char *path)
345{ 352{
346 Eina_Promise_Owner* promise = eina_promise_add(); 353 Eina_Promise_Owner* promise = eina_promise_add();
347 // Had to add the cast as dir_direct differs in the filter callback constness of one of 354 // Had to add the cast as dir_direct differs in the filter callback constness of one of
348 // its arguments. 355 // its arguments.
349 _job_direct_ls_helper((Eio_Job_Direct_Ls_Func)&eio_dir_direct_ls, obj, pd, path, promise); 356 _job_direct_ls_helper((Efl_Io_Manager_Direct_Ls_Func)&eio_dir_direct_ls, obj, pd, path, promise);
350 return eina_promise_owner_promise_get(promise); 357 return eina_promise_owner_promise_get(promise);
351} 358}
352 359
353static Eina_Promise* 360static Eina_Promise*
354_eio_job_file_ls(Eo *obj, 361_efl_io_manager_file_ls(Eo *obj,
355 Eio_Job_Data *pd, 362 Efl_Io_Manager_Data *pd,
356 const char *path) 363 const char *path)
357{ 364{
358 Eina_Promise_Owner* promise = eina_promise_add(); 365 Eina_Promise_Owner* promise = eina_promise_add();
@@ -395,8 +402,8 @@ _file_stat_done_cb(void *data, Eio_File *handle EINA_UNUSED, const Eina_Stat *st
395} 402}
396 403
397static Eina_Promise* 404static Eina_Promise*
398_eio_job_file_direct_stat(Eo *obj, 405_efl_io_manager_file_direct_stat(Eo *obj,
399 Eio_Job_Data *pd, 406 Efl_Io_Manager_Data *pd,
400 const char *path) 407 const char *path)
401{ 408{
402 Eina_Promise_Owner* promise = eina_promise_add(); 409 Eina_Promise_Owner* promise = eina_promise_add();
@@ -422,8 +429,8 @@ _eio_job_file_direct_stat(Eo *obj,
422/* eXtended attribute manipulation */ 429/* eXtended attribute manipulation */
423 430
424static Eina_Promise* 431static Eina_Promise*
425_eio_job_file_xattr_list_get(Eo *obj, 432_efl_io_manager_file_xattr_list_get(Eo *obj,
426 Eio_Job_Data *pd, 433 Efl_Io_Manager_Data *pd,
427 const char *path) 434 const char *path)
428{ 435{
429 Eina_Promise_Owner *promise = eina_promise_add(); 436 Eina_Promise_Owner *promise = eina_promise_add();
@@ -449,8 +456,8 @@ _eio_job_file_xattr_list_get(Eo *obj,
449} 456}
450 457
451static Eina_Promise* 458static Eina_Promise*
452_eio_job_file_xattr_set(Eo *obj, 459_efl_io_manager_file_xattr_set(Eo *obj,
453 Eio_Job_Data *pd, 460 Efl_Io_Manager_Data *pd,
454 const char *path, 461 const char *path,
455 const char *attribute, 462 const char *attribute,
456 const char *xattr_data, 463 const char *xattr_data,
@@ -483,8 +490,8 @@ _eio_job_file_xattr_set(Eo *obj,
483} 490}
484 491
485static Eina_Promise* 492static Eina_Promise*
486_eio_job_file_xattr_get(Eo *obj, 493_efl_io_manager_file_xattr_get(Eo *obj,
487 Eio_Job_Data *pd, 494 Efl_Io_Manager_Data *pd,
488 const char *path, 495 const char *path,
489 const char *attribute) 496 const char *attribute)
490{ 497{
@@ -521,8 +528,8 @@ _file_open_open_cb(void *data, Eio_File *handler EINA_UNUSED, Eina_File *file)
521} 528}
522 529
523static Eina_Promise* 530static Eina_Promise*
524_eio_job_file_open(Eo *obj, 531_efl_io_manager_file_open(Eo *obj,
525 Eio_Job_Data *pd, 532 Efl_Io_Manager_Data *pd,
526 const char *path, 533 const char *path,
527 Eina_Bool shared) 534 Eina_Bool shared)
528{ 535{
@@ -555,8 +562,8 @@ _file_close_done_cb(void *data, Eio_File *handler EINA_UNUSED)
555} 562}
556 563
557static void 564static void
558_eio_job_file_close(Eo *obj, 565_efl_io_manager_file_close(Eo *obj,
559 Eio_Job_Data *pd, 566 Efl_Io_Manager_Data *pd,
560 Eina_File *file, 567 Eina_File *file,
561 Eina_Promise_Owner *promise) 568 Eina_Promise_Owner *promise)
562{ 569{
@@ -573,9 +580,9 @@ _eio_job_file_close(Eo *obj,
573} 580}
574 581
575static Eo_Base* 582static Eo_Base*
576_eio_job_eo_base_constructor(Eo *obj, Eio_Job_Data *pd EINA_UNUSED) 583_efl_io_manager_eo_base_constructor(Eo *obj, Efl_Io_Manager_Data *pd EINA_UNUSED)
577{ 584{
578 obj = eo_constructor(eo_super(obj, EIO_JOB_CLASS)); 585 obj = eo_constructor(eo_super(obj, EFL_IO_MANAGER_CLASS));
579 586
580 pd->object = obj; 587 pd->object = obj;
581 pd->operations = NULL; 588 pd->operations = NULL;
@@ -584,9 +591,11 @@ _eio_job_eo_base_constructor(Eo *obj, Eio_Job_Data *pd EINA_UNUSED)
584} 591}
585 592
586static void 593static void
587_eio_job_eo_base_destructor(Eo *obj, Eio_Job_Data *pd EINA_UNUSED) 594_efl_io_manager_eo_base_destructor(Eo *obj, Efl_Io_Manager_Data *pd EINA_UNUSED)
588{ 595{
589 eo_destructor(eo_super(obj, EIO_JOB_CLASS)); 596 eo_destructor(eo_super(obj, EFL_IO_MANAGER_CLASS));
597
598 // FIXME: cancel all pending promise
590} 599}
591 600
592#include "eio_job.eo.c" 601#include "efl_io_manager.eo.c"
diff --git a/src/lib/eio/eio_job.eo b/src/lib/eio/efl_io_manager.eo
index c7fa877f5d..a89f59dd9b 100644
--- a/src/lib/eio/eio_job.eo
+++ b/src/lib/eio/efl_io_manager.eo
@@ -7,6 +7,8 @@ struct Eio.Data
7 size: uint; 7 size: uint;
8} 8}
9 9
10// FIXME: all events should be Eo objects not data if we want to modify them
11
10struct Eio.Filter.Direct.Data 12struct Eio.Filter.Direct.Data
11{ 13{
12 info: const(Eina.File.Direct.Info)*; 14 info: const(Eina.File.Direct.Info)*;
@@ -25,7 +27,9 @@ struct Eio.Xattr.Data
25 size: uint; 27 size: uint;
26} 28}
27 29
28class Eio.Job (Eo.Base) 30// FIXME: We should send list of stuff in progress not single item, callback cost is to high
31
32class Efl.Io.Manager (Eo.Base)
29{ 33{
30 [[Class representing an asynchronous file operation.]] 34 [[Class representing an asynchronous file operation.]]
31 35
diff --git a/src/lib/eio/eio_job_private.h b/src/lib/eio/eio_job_private.h
deleted file mode 100644
index 26a2a5a9b6..0000000000
--- a/src/lib/eio/eio_job_private.h
+++ /dev/null
@@ -1,12 +0,0 @@
1#ifndef _EIO_FILE_PRIVATE_H
2#define _EIO_FILE_PRIVATE_H
3
4typedef struct _Eio_Job_Data Eio_Job_Data;
5
6struct _Eio_Job_Data
7{
8 Eo *object;
9 Eina_List *operations;
10};
11
12#endif