summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-02-23 11:46:51 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-02-23 11:46:51 +0000
commit4a65416c6a121d149cb62e42ed58d4e822619772 (patch)
tree51e9df81d9b8416594e48c6346c22fdea688bd27
parentb693dd6035d1b5c74538f9d2f062ca34a5169983 (diff)
eio: use the newly introduced Eina_Stat.
SVN revision: 68316
-rw-r--r--legacy/eio/doc/eio.dox.in11
-rw-r--r--legacy/eio/src/lib/Eio.h18
-rw-r--r--legacy/eio/src/lib/eio_inline_helper.x20
-rw-r--r--legacy/eio/src/lib/eio_monitor.c2
-rw-r--r--legacy/eio/src/lib/eio_private.h2
-rw-r--r--legacy/eio/src/lib/eio_single.c33
6 files changed, 59 insertions, 27 deletions
diff --git a/legacy/eio/doc/eio.dox.in b/legacy/eio/doc/eio.dox.in
index ef333f74e0..32a97b7300 100644
--- a/legacy/eio/doc/eio.dox.in
+++ b/legacy/eio/doc/eio.dox.in
@@ -374,13 +374,13 @@
374 * static Eina_Bool 374 * static Eina_Bool
375 * _test_filter_cb(void *data, Eio_File *handler, Eina_File_Direct_Info *info) 375 * _test_filter_cb(void *data, Eio_File *handler, Eina_File_Direct_Info *info)
376 * { 376 * {
377 * struct stat *buffer; 377 * Eina_Stat *buffer;
378 * Eina_Bool isdir; 378 * Eina_Bool isdir;
379 * 379 *
380 * isdir = info->type == EINA_FILE_DIR; 380 * isdir = info->type == EINA_FILE_DIR;
381 * 381 *
382 * buffer = malloc(sizeof (struct stat)); 382 * buffer = malloc(sizeof (Eina_Stat));
383 * if (eina_file_stat(eio_file_container_get(handler), info, buffer)) 383 * if (eina_file_statat(eio_file_container_get(handler), info, buffer))
384 * { 384 * {
385 * free(buffer); 385 * free(buffer);
386 * return EINA_FALSE; 386 * return EINA_FALSE;
@@ -388,9 +388,10 @@
388 * 388 *
389 * if (!isdir && info->type == EINA_FILE_DIR) 389 * if (!isdir && info->type == EINA_FILE_DIR)
390 * { 390 * {
391 * if (lstat(info->path, buffer) == 0) 391 * struct stat st;
392 * if (lstat(info->path, &st) == 0)
392 * { 393 * {
393 * if (S_ISLNK(buffer->st_mode)) 394 * if (S_ISLNK(st.st_mode))
394 * info->type = EINA_FILE_LNK; 395 * info->type = EINA_FILE_LNK;
395 * } 396 * }
396 * } 397 * }
diff --git a/legacy/eio/src/lib/Eio.h b/legacy/eio/src/lib/Eio.h
index 3aa4fd48fb..96945c0679 100644
--- a/legacy/eio/src/lib/Eio.h
+++ b/legacy/eio/src/lib/Eio.h
@@ -116,7 +116,7 @@ typedef Eina_Bool (*Eio_Filter_Direct_Cb)(void *data, Eio_File *handler, const E
116typedef Eina_Bool (*Eio_Filter_Dir_Cb)(void *data, Eio_File *handler, Eina_File_Direct_Info *info); 116typedef Eina_Bool (*Eio_Filter_Dir_Cb)(void *data, Eio_File *handler, Eina_File_Direct_Info *info);
117typedef void (*Eio_Main_Direct_Cb)(void *data, Eio_File *handler, const Eina_File_Direct_Info *info); 117typedef void (*Eio_Main_Direct_Cb)(void *data, Eio_File *handler, const Eina_File_Direct_Info *info);
118 118
119typedef void (*Eio_Stat_Cb)(void *data, Eio_File *handler, const struct stat *stat); 119typedef void (*Eio_Stat_Cb)(void *data, Eio_File *handler, const Eina_Stat *stat);
120typedef void (*Eio_Progress_Cb)(void *data, Eio_File *handler, const Eio_Progress *info); 120typedef void (*Eio_Progress_Cb)(void *data, Eio_File *handler, const Eio_Progress *info);
121 121
122typedef void (*Eio_Eet_Open_Cb)(void *data, Eio_File *handler, Eet_File *file); 122typedef void (*Eio_Eet_Open_Cb)(void *data, Eio_File *handler, Eet_File *file);
@@ -715,44 +715,44 @@ EAPI Eina_Bool eio_file_associate_direct_add(Eio_File *ls,
715EAPI void *eio_file_associate_find(Eio_File *ls, const char *key); 715EAPI void *eio_file_associate_find(Eio_File *ls, const char *key);
716 716
717/** 717/**
718 * @brief get access time from a struct stat 718 * @brief get access time from a Eina_Stat
719 * @param stat the structure to get the atime from 719 * @param stat the structure to get the atime from
720 * @return the last accessed time 720 * @return the last accessed time
721 * 721 *
722 * This take care of doing type conversion to match rest of EFL time API. 722 * This take care of doing type conversion to match rest of EFL time API.
723 * @note some filesystem don't update that information. 723 * @note some filesystem don't update that information.
724 */ 724 */
725static inline double eio_file_atime(const struct stat *stat); 725static inline double eio_file_atime(const Eina_Stat *stat);
726 726
727/** 727/**
728 * @brief get modification time from a struct stat 728 * @brief get modification time from a Eina_Stat
729 * @param stat the structure to get the mtime from 729 * @param stat the structure to get the mtime from
730 * @return the last modification time 730 * @return the last modification time
731 * 731 *
732 * This take care of doing type conversion to match rest of EFL time API. 732 * This take care of doing type conversion to match rest of EFL time API.
733 */ 733 */
734static inline double eio_file_mtime(const struct stat *stat); 734static inline double eio_file_mtime(const Eina_Stat *stat);
735 735
736/** 736/**
737 * @brief get the size of the file described in struct stat 737 * @brief get the size of the file described in Eina_Stat
738 * @param stat the structure to get the size from 738 * @param stat the structure to get the size from
739 * @return the size of the file 739 * @return the size of the file
740 */ 740 */
741static inline long long eio_file_size(const struct stat *stat); 741static inline long long eio_file_size(const Eina_Stat *stat);
742 742
743/** 743/**
744 * @brief tell if the stated path was a directory or not. 744 * @brief tell if the stated path was a directory or not.
745 * @param stat the structure to get the size from 745 * @param stat the structure to get the size from
746 * @return EINA_TRUE, if it was. 746 * @return EINA_TRUE, if it was.
747 */ 747 */
748static inline Eina_Bool eio_file_is_dir(const struct stat *stat); 748static inline Eina_Bool eio_file_is_dir(const Eina_Stat *stat);
749 749
750/** 750/**
751 * @brief tell if the stated path was a link or not. 751 * @brief tell if the stated path was a link or not.
752 * @param stat the structure to get the size from 752 * @param stat the structure to get the size from
753 * @return EINA_TRUE, if it was. 753 * @return EINA_TRUE, if it was.
754 */ 754 */
755static inline Eina_Bool eio_file_is_lnk(const struct stat *stat); 755static inline Eina_Bool eio_file_is_lnk(const Eina_Stat *stat);
756 756
757/** 757/**
758 * @} 758 * @}
diff --git a/legacy/eio/src/lib/eio_inline_helper.x b/legacy/eio/src/lib/eio_inline_helper.x
index 778009e9b5..af49646b72 100644
--- a/legacy/eio/src/lib/eio_inline_helper.x
+++ b/legacy/eio/src/lib/eio_inline_helper.x
@@ -36,10 +36,10 @@
36 * This function return the st_atime field, last acces time, as double like all EFL time call. 36 * This function return the st_atime field, last acces time, as double like all EFL time call.
37 */ 37 */
38static inline double 38static inline double
39eio_file_atime(const struct stat *st) 39eio_file_atime(const Eina_Stat *st)
40{ 40{
41 if (!st) return 0.0; 41 if (!st) return 0.0;
42 return (double) st->st_atime; 42 return (double) st->atime;
43} 43}
44 44
45/** 45/**
@@ -50,10 +50,10 @@ eio_file_atime(const struct stat *st)
50 * This function return the st_mtime field, last modification time, as double like all EFL time call. 50 * This function return the st_mtime field, last modification time, as double like all EFL time call.
51 */ 51 */
52static inline double 52static inline double
53eio_file_mtime(const struct stat *st) 53eio_file_mtime(const Eina_Stat *st)
54{ 54{
55 if (!st) return 0.0; 55 if (!st) return 0.0;
56 return (double) st->st_mtime; 56 return (double) st->mtime;
57} 57}
58 58
59/** 59/**
@@ -64,10 +64,10 @@ eio_file_mtime(const struct stat *st)
64 * This function is just an accessor to st_size and return the file length. 64 * This function is just an accessor to st_size and return the file length.
65 */ 65 */
66static inline long long 66static inline long long
67eio_file_size(const struct stat *st) 67eio_file_size(const Eina_Stat *st)
68{ 68{
69 if (!st) return 0; 69 if (!st) return 0;
70 return st->st_size; 70 return st->size;
71} 71}
72 72
73/** 73/**
@@ -78,10 +78,10 @@ eio_file_size(const struct stat *st)
78 * This function tell you if the stated path is a directory or not. 78 * This function tell you if the stated path is a directory or not.
79 */ 79 */
80static inline Eina_Bool 80static inline Eina_Bool
81eio_file_is_dir(const struct stat *st) 81eio_file_is_dir(const Eina_Stat *st)
82{ 82{
83 if (!st) return EINA_FALSE; 83 if (!st) return EINA_FALSE;
84 return (S_ISDIR(st->st_mode)) ? EINA_TRUE : EINA_FALSE; 84 return (S_ISDIR(st->mode)) ? EINA_TRUE : EINA_FALSE;
85} 85}
86 86
87/** 87/**
@@ -92,10 +92,10 @@ eio_file_is_dir(const struct stat *st)
92 * This function tell you if the stated path is a length or not. 92 * This function tell you if the stated path is a length or not.
93 */ 93 */
94static inline Eina_Bool 94static inline Eina_Bool
95eio_file_is_lnk(const struct stat *st) 95eio_file_is_lnk(const Eina_Stat *st)
96{ 96{
97 if (!st) return EINA_FALSE; 97 if (!st) return EINA_FALSE;
98 return (S_ISLNK(st->st_mode)) ? EINA_TRUE : EINA_FALSE; 98 return (S_ISLNK(st->mode)) ? EINA_TRUE : EINA_FALSE;
99} 99}
100 100
101/** 101/**
diff --git a/legacy/eio/src/lib/eio_monitor.c b/legacy/eio/src/lib/eio_monitor.c
index 1119e6dadb..d99af0f227 100644
--- a/legacy/eio/src/lib/eio_monitor.c
+++ b/legacy/eio/src/lib/eio_monitor.c
@@ -76,7 +76,7 @@ _eio_monitor_event_cleanup_cb(__UNUSED__ void *user_data, void *func_data)
76} 76}
77 77
78static void 78static void
79_eio_monitor_stat_cb(void *data, __UNUSED__ Eio_File *handler, __UNUSED__ const struct stat *st) 79_eio_monitor_stat_cb(void *data, __UNUSED__ Eio_File *handler, __UNUSED__ const Eina_Stat *st)
80{ 80{
81 Eio_Monitor *monitor = data; 81 Eio_Monitor *monitor = data;
82 82
diff --git a/legacy/eio/src/lib/eio_private.h b/legacy/eio/src/lib/eio_private.h
index 69dee463d8..434f207904 100644
--- a/legacy/eio/src/lib/eio_private.h
+++ b/legacy/eio/src/lib/eio_private.h
@@ -275,7 +275,7 @@ struct _Eio_File_Stat
275 275
276 Eio_Stat_Cb done_cb; 276 Eio_Stat_Cb done_cb;
277 277
278 struct stat buffer; 278 Eina_Stat buffer;
279 const char *path; 279 const char *path;
280}; 280};
281 281
diff --git a/legacy/eio/src/lib/eio_single.c b/legacy/eio/src/lib/eio_single.c
index 428c989b12..0a8ee868b2 100644
--- a/legacy/eio/src/lib/eio_single.c
+++ b/legacy/eio/src/lib/eio_single.c
@@ -105,9 +105,40 @@ static void
105_eio_file_stat(void *data, Ecore_Thread *thread) 105_eio_file_stat(void *data, Ecore_Thread *thread)
106{ 106{
107 Eio_File_Stat *s = data; 107 Eio_File_Stat *s = data;
108 struct stat buf;
108 109
109 if (stat(s->path, &s->buffer) != 0) 110 if (stat(s->path, &buf) != 0)
110 eio_file_thread_error(&s->common, thread); 111 eio_file_thread_error(&s->common, thread);
112
113 s->buffer.dev = buf.st_dev;
114 s->buffer.ino = buf.st_ino;
115 s->buffer.mode = buf.st_mode;
116 s->buffer.nlink = buf.st_nlink;
117 s->buffer.uid = buf.st_uid;
118 s->buffer.gid = buf.st_gid;
119 s->buffer.rdev = buf.st_rdev;
120 s->buffer.size = buf.st_size;
121 s->buffer.blksize = buf.st_blksize;
122 s->buffer.blocks = buf.st_blocks;
123 s->buffer.atime = buf.st_atime;
124 s->buffer.mtime = buf.st_mtime;
125 s->buffer.ctime = buf.st_ctime;
126#ifdef _STAT_VER_LINUX
127# if (defined __USE_MISC && defined st_mtime)
128 s->buffer.atimensec = buf.st_atim.tv_nsec;
129 s->buffer.mtimensec = buf.st_mtim.tv_nsec;
130 s->buffer.ctimensec = buf.st_ctim.tv_nsec;
131# else
132 s->buffer.atimensec = buf.st_atimensec;
133 s->buffer.mtimensec = buf.st_mtimensec;
134 s->buffer.ctimensec = buf.st_ctimensec;
135# endif
136#else
137 s->buffer.atimensec = 0;
138 s->buffer.mtimensec = 0;
139 s->buffer.ctimensec = 0;
140#endif
141
111} 142}
112 143
113static void 144static void