summaryrefslogtreecommitdiff
path: root/src/lib/eio
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2016-07-31 21:39:39 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-08 14:58:06 -0700
commit11fe9b8cd9e4eee6f95e70fcef8727087c1a49a2 (patch)
tree26bb1d848ba8cff9f06a1e5a5eb250f2ac5b1643 /src/lib/eio
parentd26a0a2f70a77457f9faf35d945a2947f5f5cdba (diff)
eio: add internal function able to build array instead of triggering a callback per files.
Diffstat (limited to 'src/lib/eio')
-rw-r--r--src/lib/eio/eio_dir.c131
-rw-r--r--src/lib/eio/eio_file.c210
-rw-r--r--src/lib/eio/eio_private.h51
3 files changed, 309 insertions, 83 deletions
diff --git a/src/lib/eio/eio_dir.c b/src/lib/eio/eio_dir.c
index 9d0c72e7bf..e275ae9f70 100644
--- a/src/lib/eio/eio_dir.c
+++ b/src/lib/eio/eio_dir.c
@@ -742,29 +742,6 @@ _eio_dir_direct_find_heavy(void *data, Ecore_Thread *thread)
742} 742}
743 743
744static void 744static void
745_eio_dir_stat_find_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data)
746{
747 Eio_File_Dir_Ls *async = data;
748 Eina_List *pack = msg_data;
749 Eio_File_Direct_Info *info;
750
751 EINA_LIST_FREE(pack, info)
752 {
753 async->ls.common.main.associated = info->associated;
754
755 async->main_cb((void*) async->ls.common.data, &async->ls.common, &info->info);
756
757 if (async->ls.common.main.associated)
758 {
759 eina_hash_free(async->ls.common.main.associated);
760 async->ls.common.main.associated = NULL;
761 }
762
763 eio_direct_info_free(info);
764 }
765}
766
767static void
768_eio_dir_stat_done(void *data, Ecore_Thread *thread EINA_UNUSED) 745_eio_dir_stat_done(void *data, Ecore_Thread *thread EINA_UNUSED)
769{ 746{
770 Eio_File_Ls *async = data; 747 Eio_File_Ls *async = data;
@@ -919,18 +896,18 @@ eio_dir_unlink(const char *path,
919 return &rmrf->progress.common; 896 return &rmrf->progress.common;
920} 897}
921 898
922EAPI Eio_File * 899static Eio_File *
923eio_dir_stat_ls(const char *dir, 900_eio_dir_stat_internal_ls(const char *dir,
924 Eio_Filter_Direct_Cb filter_cb, 901 Eio_Filter_Direct_Cb filter_cb,
925 Eio_Main_Direct_Cb main_cb, 902 Eio_Main_Direct_Cb main_cb,
926 Eio_Done_Cb done_cb, 903 Eio_Array_Cb main_internal_cb,
927 Eio_Error_Cb error_cb, 904 Eio_Done_Cb done_cb,
928 const void *data) 905 Eio_Error_Cb error_cb,
906 const void *data)
929{ 907{
930 Eio_File_Dir_Ls *async; 908 Eio_File_Dir_Ls *async;
931 909
932 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL); 910 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL);
933 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
934 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); 911 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
935 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); 912 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
936 913
@@ -942,16 +919,24 @@ eio_dir_stat_ls(const char *dir,
942 * where info can be modified, but in our case it's already doing 919 * where info can be modified, but in our case it's already doing
943 * stat() then it shouldn't be needed! 920 * stat() then it shouldn't be needed!
944 */ 921 */
945 async->filter_cb = (Eio_Filter_Dir_Cb)filter_cb;
946 async->main_cb = main_cb;
947 async->ls.directory = eina_stringshare_add(dir); 922 async->ls.directory = eina_stringshare_add(dir);
923 async->filter_cb = (Eio_Filter_Dir_Cb)filter_cb;
924 if (main_internal_cb)
925 {
926 async->main_internal_cb = main_internal_cb;
927 async->ls.gather = EINA_TRUE;
928 }
929 else
930 {
931 async->main_cb = main_cb;
932 }
948 933
949 if (!eio_long_file_set(&async->ls.common, 934 if (!eio_long_file_set(&async->ls.common,
950 done_cb, 935 done_cb,
951 error_cb, 936 error_cb,
952 data, 937 data,
953 _eio_dir_stat_find_heavy, 938 _eio_dir_stat_find_heavy,
954 _eio_dir_stat_find_notify, 939 _eio_direct_notify,
955 _eio_dir_stat_done, 940 _eio_dir_stat_done,
956 _eio_dir_stat_error)) 941 _eio_dir_stat_error))
957 return NULL; 942 return NULL;
@@ -960,36 +945,94 @@ eio_dir_stat_ls(const char *dir,
960} 945}
961 946
962EAPI Eio_File * 947EAPI Eio_File *
963eio_dir_direct_ls(const char *dir, 948eio_dir_stat_ls(const char *dir,
964 Eio_Filter_Dir_Cb filter_cb, 949 Eio_Filter_Direct_Cb filter_cb,
965 Eio_Main_Direct_Cb main_cb, 950 Eio_Main_Direct_Cb main_cb,
966 Eio_Done_Cb done_cb, 951 Eio_Done_Cb done_cb,
967 Eio_Error_Cb error_cb, 952 Eio_Error_Cb error_cb,
968 const void *data) 953 const void *data)
954{
955 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
956
957 return _eio_dir_stat_internal_ls(dir, filter_cb, main_cb, NULL, done_cb, error_cb, data);
958}
959
960Eio_File *
961_eio_dir_stat_ls(const char *dir,
962 Eio_Array_Cb main_internal_cb,
963 Eio_Done_Cb done_cb,
964 Eio_Error_Cb error_cb,
965 const void *data)
966{
967 EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
968
969 return _eio_dir_stat_internal_ls(dir, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
970}
971
972static Eio_File *
973_eio_dir_direct_internal_ls(const char *dir,
974 Eio_Filter_Dir_Cb filter_cb,
975 Eio_Main_Direct_Cb main_cb,
976 Eio_Array_Cb main_internal_cb,
977 Eio_Done_Cb done_cb,
978 Eio_Error_Cb error_cb,
979 const void *data)
969{ 980{
970 Eio_File_Dir_Ls *async; 981 Eio_File_Dir_Ls *async;
971 982
972 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL); 983 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL);
973 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
974 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); 984 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
975 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); 985 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
976 986
977 async = malloc(sizeof(Eio_File_Dir_Ls)); 987 async = malloc(sizeof(Eio_File_Dir_Ls));
978 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL); 988 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL);
979 989
980 async->filter_cb = filter_cb;
981 async->main_cb = main_cb;
982 async->ls.directory = eina_stringshare_add(dir); 990 async->ls.directory = eina_stringshare_add(dir);
991 async->filter_cb = filter_cb;
992 if (main_internal_cb)
993 {
994 async->main_internal_cb = main_internal_cb;
995 async->ls.gather = EINA_TRUE;
996 }
997 else
998 {
999 async->main_cb = main_cb;
1000 }
983 1001
984 if (!eio_long_file_set(&async->ls.common, 1002 if (!eio_long_file_set(&async->ls.common,
985 done_cb, 1003 done_cb,
986 error_cb, 1004 error_cb,
987 data, 1005 data,
988 _eio_dir_direct_find_heavy, 1006 _eio_dir_direct_find_heavy,
989 _eio_dir_stat_find_notify, 1007 _eio_direct_notify,
990 _eio_dir_stat_done, 1008 _eio_dir_stat_done,
991 _eio_dir_stat_error)) 1009 _eio_dir_stat_error))
992 return NULL; 1010 return NULL;
993 1011
994 return &async->ls.common; 1012 return &async->ls.common;
995} 1013}
1014
1015EAPI Eio_File *
1016eio_dir_direct_ls(const char *dir,
1017 Eio_Filter_Dir_Cb filter_cb,
1018 Eio_Main_Direct_Cb main_cb,
1019 Eio_Done_Cb done_cb,
1020 Eio_Error_Cb error_cb,
1021 const void *data)
1022{
1023 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
1024
1025 return _eio_dir_direct_internal_ls(dir, filter_cb, main_cb, NULL, done_cb, error_cb, data);
1026}
1027
1028Eio_File *
1029_eio_dir_direct_ls(const char *dir,
1030 Eio_Array_Cb main_internal_cb,
1031 Eio_Done_Cb done_cb,
1032 Eio_Error_Cb error_cb,
1033 const void *data)
1034{
1035 EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
1036
1037 return _eio_dir_direct_internal_ls(dir, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
1038}
diff --git a/src/lib/eio/eio_file.c b/src/lib/eio/eio_file.c
index a7c02b9a40..1afa4ab165 100644
--- a/src/lib/eio/eio_file.c
+++ b/src/lib/eio/eio_file.c
@@ -95,8 +95,8 @@ _eio_file_heavy(void *data, Ecore_Thread *thread)
95 async->ls.ls = ls; 95 async->ls.ls = ls;
96} 96}
97 97
98static void 98void
99_eio_file_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data) 99_eio_string_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data)
100{ 100{
101 Eio_File_Char_Ls *async = data; 101 Eio_File_Char_Ls *async = data;
102 Eina_List *pack = msg_data; 102 Eina_List *pack = msg_data;
@@ -104,6 +104,29 @@ _eio_file_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data)
104 104
105 async->ls.common.length += eina_list_count(pack); 105 async->ls.common.length += eina_list_count(pack);
106 106
107 // Check if it is an internal use
108 if (async->ls.gather)
109 {
110 Eina_Array *gather;
111
112 gather = eina_array_new(eina_list_count(pack));
113 EINA_LIST_FREE(pack, info)
114 {
115 if (!gather)
116 eina_stringshare_del(info->filename);
117 else
118 eina_array_push(gather, info->filename);
119 eio_char_free(info);
120 }
121
122 // transfer ownership to caller
123 async->main_internal_cb((void*) async->ls.common.data,
124 &async->ls.common,
125 gather);
126
127 return ;
128 }
129
107 EINA_LIST_FREE(pack, info) 130 EINA_LIST_FREE(pack, info)
108 { 131 {
109 async->ls.common.main.associated = info->associated; 132 async->ls.common.main.associated = info->associated;
@@ -201,8 +224,8 @@ _eio_file_stat_heavy(void *data, Ecore_Thread *thread)
201 _eio_file_eina_ls_heavy(thread, async, ls); 224 _eio_file_eina_ls_heavy(thread, async, ls);
202} 225}
203 226
204static void 227void
205_eio_file_direct_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data) 228_eio_direct_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data)
206{ 229{
207 Eio_File_Direct_Ls *async = data; 230 Eio_File_Direct_Ls *async = data;
208 Eina_List *pack = msg_data; 231 Eina_List *pack = msg_data;
@@ -210,6 +233,23 @@ _eio_file_direct_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_
210 233
211 async->ls.common.length += eina_list_count(pack); 234 async->ls.common.length += eina_list_count(pack);
212 235
236 // Check if it is an internal use
237 if (async->ls.gather)
238 {
239 Eina_Array *gather;
240
241 gather = eina_array_new(eina_list_count(pack));
242 EINA_LIST_FREE(pack, info)
243 eina_array_push(gather, &info->info);
244
245 // transfer ownership to caller
246 async->main_internal_cb((void*) async->ls.common.data,
247 &async->ls.common,
248 gather);
249
250 return ;
251 }
252
213 EINA_LIST_FREE(pack, info) 253 EINA_LIST_FREE(pack, info)
214 { 254 {
215 async->ls.common.main.associated = info->associated; 255 async->ls.common.main.associated = info->associated;
@@ -491,35 +531,42 @@ eio_async_error(void *data, Ecore_Thread *thread EINA_UNUSED)
491/*============================================================================* 531/*============================================================================*
492 * API * 532 * API *
493 *============================================================================*/ 533 *============================================================================*/
494 534static Eio_File *
495EAPI Eio_File * 535_eio_file_internal_ls(const char *dir,
496eio_file_ls(const char *dir, 536 Eio_Filter_Cb filter_cb,
497 Eio_Filter_Cb filter_cb, 537 Eio_Main_Cb main_cb,
498 Eio_Main_Cb main_cb, 538 Eio_Array_Cb main_internal_cb,
499 Eio_Done_Cb done_cb, 539 Eio_Done_Cb done_cb,
500 Eio_Error_Cb error_cb, 540 Eio_Error_Cb error_cb,
501 const void *data) 541 const void *data)
502{ 542{
503 Eio_File_Char_Ls *async; 543 Eio_File_Char_Ls *async;
504 544
505 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL); 545 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL);
506 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
507 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); 546 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
508 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); 547 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
509 548
510 async = eio_common_alloc(sizeof(Eio_File_Char_Ls)); 549 async = eio_common_alloc(sizeof(Eio_File_Char_Ls));
511 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL); 550 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL);
512 551
513 async->filter_cb = filter_cb;
514 async->main_cb = main_cb;
515 async->ls.directory = eina_stringshare_add(dir); 552 async->ls.directory = eina_stringshare_add(dir);
553 async->filter_cb = filter_cb;
554 if (main_internal_cb)
555 {
556 async->main_internal_cb = main_internal_cb;
557 async->ls.gather = EINA_TRUE;
558 }
559 else
560 {
561 async->main_cb = main_cb;
562 }
516 563
517 if (!eio_long_file_set(&async->ls.common, 564 if (!eio_long_file_set(&async->ls.common,
518 done_cb, 565 done_cb,
519 error_cb, 566 error_cb,
520 data, 567 data,
521 _eio_file_heavy, 568 _eio_file_heavy,
522 _eio_file_notify, 569 _eio_string_notify,
523 eio_async_end, 570 eio_async_end,
524 eio_async_error)) 571 eio_async_error))
525 return NULL; 572 return NULL;
@@ -528,33 +575,66 @@ eio_file_ls(const char *dir,
528} 575}
529 576
530EAPI Eio_File * 577EAPI Eio_File *
531eio_file_direct_ls(const char *dir, 578eio_file_ls(const char *dir,
532 Eio_Filter_Direct_Cb filter_cb, 579 Eio_Filter_Cb filter_cb,
533 Eio_Main_Direct_Cb main_cb, 580 Eio_Main_Cb main_cb,
534 Eio_Done_Cb done_cb, 581 Eio_Done_Cb done_cb,
535 Eio_Error_Cb error_cb, 582 Eio_Error_Cb error_cb,
536 const void *data) 583 const void *data)
584{
585 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
586
587 return _eio_file_internal_ls(dir, filter_cb, main_cb, NULL, done_cb, error_cb, data);
588}
589
590Eio_File *
591_eio_file_ls(const char *dir,
592 Eio_Array_Cb main_internal_cb,
593 Eio_Done_Cb done_cb,
594 Eio_Error_Cb error_cb,
595 const void *data)
596{
597 EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
598
599 return _eio_file_internal_ls(dir, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
600}
601
602static Eio_File *
603_eio_file_direct_internal_ls(const char *dir,
604 Eio_Filter_Direct_Cb filter_cb,
605 Eio_Main_Direct_Cb main_cb,
606 Eio_Array_Cb main_internal_cb,
607 Eio_Done_Cb done_cb,
608 Eio_Error_Cb error_cb,
609 const void *data)
537{ 610{
538 Eio_File_Direct_Ls *async; 611 Eio_File_Direct_Ls *async;
539 612
540 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL); 613 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL);
541 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
542 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); 614 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
543 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); 615 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
544 616
545 async = eio_common_alloc(sizeof(Eio_File_Direct_Ls)); 617 async = eio_common_alloc(sizeof(Eio_File_Direct_Ls));
546 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL); 618 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL);
547 619
548 async->filter_cb = filter_cb;
549 async->main_cb = main_cb;
550 async->ls.directory = eina_stringshare_add(dir); 620 async->ls.directory = eina_stringshare_add(dir);
621 async->filter_cb = filter_cb;
622 if (main_internal_cb)
623 {
624 async->main_internal_cb = main_internal_cb;
625 async->ls.gather = EINA_TRUE;
626 }
627 else
628 {
629 async->main_cb = main_cb;
630 }
551 631
552 if (!eio_long_file_set(&async->ls.common, 632 if (!eio_long_file_set(&async->ls.common,
553 done_cb, 633 done_cb,
554 error_cb, 634 error_cb,
555 data, 635 data,
556 _eio_file_direct_heavy, 636 _eio_file_direct_heavy,
557 _eio_file_direct_notify, 637 _eio_direct_notify,
558 eio_async_end, 638 eio_async_end,
559 eio_async_error)) 639 eio_async_error))
560 return NULL; 640 return NULL;
@@ -563,33 +643,66 @@ eio_file_direct_ls(const char *dir,
563} 643}
564 644
565EAPI Eio_File * 645EAPI Eio_File *
566eio_file_stat_ls(const char *dir, 646eio_file_direct_ls(const char *dir,
567 Eio_Filter_Direct_Cb filter_cb, 647 Eio_Filter_Direct_Cb filter_cb,
568 Eio_Main_Direct_Cb main_cb, 648 Eio_Main_Direct_Cb main_cb,
569 Eio_Done_Cb done_cb, 649 Eio_Done_Cb done_cb,
570 Eio_Error_Cb error_cb, 650 Eio_Error_Cb error_cb,
571 const void *data) 651 const void *data)
652{
653 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
654
655 return _eio_file_direct_internal_ls(dir, filter_cb, main_cb, NULL, done_cb, error_cb, data);
656}
657
658Eio_File *
659_eio_file_direct_ls(const char *dir,
660 Eio_Array_Cb main_internal_cb,
661 Eio_Done_Cb done_cb,
662 Eio_Error_Cb error_cb,
663 const void *data)
664{
665 EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
666
667 return _eio_file_direct_internal_ls(dir, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
668}
669
670static Eio_File *
671_eio_file_stat_internal_ls(const char *dir,
672 Eio_Filter_Direct_Cb filter_cb,
673 Eio_Main_Direct_Cb main_cb,
674 Eio_Array_Cb main_internal_cb,
675 Eio_Done_Cb done_cb,
676 Eio_Error_Cb error_cb,
677 const void *data)
572{ 678{
573 Eio_File_Direct_Ls *async; 679 Eio_File_Direct_Ls *async;
574 680
575 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL); 681 EINA_SAFETY_ON_NULL_RETURN_VAL(dir, NULL);
576 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
577 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL); 682 EINA_SAFETY_ON_NULL_RETURN_VAL(done_cb, NULL);
578 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL); 683 EINA_SAFETY_ON_NULL_RETURN_VAL(error_cb, NULL);
579 684
580 async = eio_common_alloc(sizeof(Eio_File_Direct_Ls)); 685 async = eio_common_alloc(sizeof(Eio_File_Direct_Ls));
581 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL); 686 EINA_SAFETY_ON_NULL_RETURN_VAL(async, NULL);
582 687
583 async->filter_cb = filter_cb;
584 async->main_cb = main_cb;
585 async->ls.directory = eina_stringshare_add(dir); 688 async->ls.directory = eina_stringshare_add(dir);
689 async->filter_cb = filter_cb;
690 if (main_internal_cb)
691 {
692 async->main_internal_cb = main_internal_cb;
693 async->ls.gather = EINA_TRUE;
694 }
695 else
696 {
697 async->main_cb = main_cb;
698 }
586 699
587 if (!eio_long_file_set(&async->ls.common, 700 if (!eio_long_file_set(&async->ls.common,
588 done_cb, 701 done_cb,
589 error_cb, 702 error_cb,
590 data, 703 data,
591 _eio_file_stat_heavy, 704 _eio_file_stat_heavy,
592 _eio_file_direct_notify, 705 _eio_direct_notify,
593 eio_async_end, 706 eio_async_end,
594 eio_async_error)) 707 eio_async_error))
595 return NULL; 708 return NULL;
@@ -597,6 +710,31 @@ eio_file_stat_ls(const char *dir,
597 return &async->ls.common; 710 return &async->ls.common;
598} 711}
599 712
713EAPI Eio_File *
714eio_file_stat_ls(const char *dir,
715 Eio_Filter_Direct_Cb filter_cb,
716 Eio_Main_Direct_Cb main_cb,
717 Eio_Done_Cb done_cb,
718 Eio_Error_Cb error_cb,
719 const void *data)
720{
721 EINA_SAFETY_ON_NULL_RETURN_VAL(main_cb, NULL);
722
723 return _eio_file_stat_internal_ls(dir, filter_cb, main_cb, NULL, done_cb, error_cb, data);
724}
725
726Eio_File *
727_eio_file_stat_ls(const char *dir,
728 Eio_Array_Cb main_internal_cb,
729 Eio_Done_Cb done_cb,
730 Eio_Error_Cb error_cb,
731 const void *data)
732{
733 EINA_SAFETY_ON_NULL_RETURN_VAL(main_internal_cb, NULL);
734
735 return _eio_file_stat_internal_ls(dir, NULL, NULL, main_internal_cb, done_cb, error_cb, data);
736}
737
600EAPI Eina_Bool 738EAPI Eina_Bool
601eio_file_cancel(Eio_File *ls) 739eio_file_cancel(Eio_File *ls)
602{ 740{
diff --git a/src/lib/eio/eio_private.h b/src/lib/eio/eio_private.h
index 39c37ae20b..69a73d3020 100644
--- a/src/lib/eio/eio_private.h
+++ b/src/lib/eio/eio_private.h
@@ -104,6 +104,8 @@ extern int _eio_log_dom_global;
104#endif /* ifdef CRI */ 104#endif /* ifdef CRI */
105#define CRI(...) EINA_LOG_DOM_CRIT(_eio_log_dom_global, __VA_ARGS__) 105#define CRI(...) EINA_LOG_DOM_CRIT(_eio_log_dom_global, __VA_ARGS__)
106 106
107typedef void (*Eio_Array_Cb)(void *data, Eio_File *common, Eina_Array *g);
108
107typedef struct _Eio_Eet_Open Eio_Eet_Open; 109typedef struct _Eio_Eet_Open Eio_Eet_Open;
108typedef struct _Eio_Eet_Simple Eio_Eet_Simple; 110typedef struct _Eio_Eet_Simple Eio_Eet_Simple;
109typedef struct _Eio_Eet_Write Eio_Eet_Write; 111typedef struct _Eio_Eet_Write Eio_Eet_Write;
@@ -142,6 +144,7 @@ struct _Eio_File_Associate
142 144
143struct _Eio_File_Direct_Info 145struct _Eio_File_Direct_Info
144{ 146{
147 // Do not put anything before info
145 Eina_File_Direct_Info info; 148 Eina_File_Direct_Info info;
146 149
147 Eina_Hash *associated; 150 Eina_Hash *associated;
@@ -278,6 +281,8 @@ struct _Eio_File_Ls
278 Eio_File common; 281 Eio_File common;
279 const char *directory; 282 const char *directory;
280 Eina_Iterator *ls; 283 Eina_Iterator *ls;
284
285 Eina_Bool gather;
281}; 286};
282 287
283struct _Eio_File_Direct_Ls 288struct _Eio_File_Direct_Ls
@@ -285,7 +290,10 @@ struct _Eio_File_Direct_Ls
285 Eio_File_Ls ls; 290 Eio_File_Ls ls;
286 291
287 Eio_Filter_Direct_Cb filter_cb; 292 Eio_Filter_Direct_Cb filter_cb;
288 Eio_Main_Direct_Cb main_cb; 293 union {
294 Eio_Main_Direct_Cb main_cb;
295 Eio_Array_Cb main_internal_cb;
296 };
289 297
290 Eina_List *pack; 298 Eina_List *pack;
291 double start; 299 double start;
@@ -296,7 +304,10 @@ struct _Eio_File_Dir_Ls
296 Eio_File_Ls ls; 304 Eio_File_Ls ls;
297 305
298 Eio_Filter_Dir_Cb filter_cb; 306 Eio_Filter_Dir_Cb filter_cb;
299 Eio_Main_Direct_Cb main_cb; 307 union {
308 Eio_Main_Direct_Cb main_cb;
309 Eio_Array_Cb main_internal_cb;
310 };
300 311
301 Eina_List *pack; 312 Eina_List *pack;
302 double start; 313 double start;
@@ -307,7 +318,10 @@ struct _Eio_File_Char_Ls
307 Eio_File_Ls ls; 318 Eio_File_Ls ls;
308 319
309 Eio_Filter_Cb filter_cb; 320 Eio_Filter_Cb filter_cb;
310 Eio_Main_Cb main_cb; 321 union {
322 Eio_Main_Cb main_cb;
323 Eio_Array_Cb main_internal_cb;
324 };
311}; 325};
312 326
313struct _Eio_File_Mkdir 327struct _Eio_File_Mkdir
@@ -506,4 +520,35 @@ void eio_common_free(Eio_File *common);
506void eio_file_register(Eio_File *common); 520void eio_file_register(Eio_File *common);
507void eio_file_unregister(Eio_File *common); 521void eio_file_unregister(Eio_File *common);
508 522
523Eio_File * _eio_file_ls(const char *dir,
524 Eio_Array_Cb main_internal_cb,
525 Eio_Done_Cb done_cb,
526 Eio_Error_Cb error_cb,
527 const void *data);
528Eio_File * _eio_file_direct_ls(const char *dir,
529 Eio_Array_Cb main_internal_cb,
530 Eio_Done_Cb done_cb,
531 Eio_Error_Cb error_cb,
532 const void *data);
533Eio_File * _eio_dir_direct_ls(const char *dir,
534 Eio_Array_Cb main_internal_cb,
535 Eio_Done_Cb done_cb,
536 Eio_Error_Cb error_cb,
537 const void *data);
538Eio_File * _eio_file_stat_ls(const char *dir,
539 Eio_Array_Cb main_internal_cb,
540 Eio_Done_Cb done_cb,
541 Eio_Error_Cb error_cb,
542 const void *data);
543Eio_File * _eio_dir_stat_ls(const char *dir,
544 Eio_Array_Cb main_internal_cb,
545 Eio_Done_Cb done_cb,
546 Eio_Error_Cb error_cb,
547 const void *data);
548
549// Sharing notifier between recursive and non recursive code.
550void _eio_string_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data);
551void _eio_direct_notify(void *data, Ecore_Thread *thread EINA_UNUSED, void *msg_data);
552
553
509#endif 554#endif