aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_file.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/include/eina_file.h')
-rw-r--r--libraries/eina/src/include/eina_file.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/libraries/eina/src/include/eina_file.h b/libraries/eina/src/include/eina_file.h
index 422fb65..1af22af 100644
--- a/libraries/eina/src/include/eina_file.h
+++ b/libraries/eina/src/include/eina_file.h
@@ -22,6 +22,7 @@
22 22
23#include <limits.h> 23#include <limits.h>
24#include <time.h> 24#include <time.h>
25#include <sys/stat.h>
25 26
26#include "eina_types.h" 27#include "eina_types.h"
27#include "eina_array.h" 28#include "eina_array.h"
@@ -91,6 +92,13 @@
91typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info; 92typedef struct _Eina_File_Direct_Info Eina_File_Direct_Info;
92 93
93/** 94/**
95 * @typedef Eina_Stat
96 * A typedef to #_Eina_Stat.
97 * @since 1.2
98 */
99typedef struct _Eina_Stat Eina_Stat;
100
101/**
94 * @typedef Eina_File_Dir_List_Cb 102 * @typedef Eina_File_Dir_List_Cb
95 * Type for a callback to be called when iterating over the files of a 103 * Type for a callback to be called when iterating over the files of a
96 * directory. 104 * directory.
@@ -149,6 +157,31 @@ struct _Eina_File_Direct_Info
149}; 157};
150 158
151/** 159/**
160 * @struct _Eina_Stat
161 * A structure to store informations of a path.
162 * @since 1.2
163 */
164struct _Eina_Stat
165{
166 unsigned long int dev;
167 unsigned long int ino;
168 unsigned int mode;
169 unsigned int nlink;
170 unsigned int uid;
171 unsigned int gid;
172 unsigned long int rdev;
173 unsigned long int size;
174 unsigned long int blksize;
175 unsigned long int blocks;
176 unsigned long int atime;
177 unsigned long int atimensec;
178 unsigned long int mtime;
179 unsigned long int mtimensec;
180 unsigned long int ctime;
181 unsigned long int ctimensec;
182};
183
184/**
152 * @def EINA_FILE_DIR_LIST_CB 185 * @def EINA_FILE_DIR_LIST_CB
153 * @brief cast to an #Eina_File_Dir_List_Cb. 186 * @brief cast to an #Eina_File_Dir_List_Cb.
154 * 187 *
@@ -247,6 +280,24 @@ EAPI Eina_Iterator *eina_file_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_A
247EAPI Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC; 280EAPI Eina_Iterator *eina_file_stat_ls(const char *dir) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1) EINA_MALLOC;
248 281
249/** 282/**
283 * @brief Use information provided by Eina_Iterator of eina_file_stat_ls or eina_file_direct_ls
284 * to call stat in the most efficient way on your system.
285 *
286 * @param container The container returned by the Eina_Iterator using eina_iterator_container_get().
287 * @param info The content of the current Eina_File_Direct_Info provided by the Eina_Iterator
288 * @param buf Where to put the result of the stat
289 * @return On success 0 is returned, On error -1 is returned and errno is set appropriately.
290 *
291 * This function calls fstatat or stat depending on what your system supports. This makes it efficient and simple
292 * to use on your side without complex detection already done inside Eina on what the system can do.
293 *
294 * @see eina_file_direct_ls()
295 * @see eina_file_stat_ls()
296 * @since 1.2
297 */
298EAPI int eina_file_statat(void *container, Eina_File_Direct_Info *info, Eina_Stat *buf) EINA_WARN_UNUSED_RESULT EINA_ARG_NONNULL(1, 2, 3);
299
300/**
250 * @brief Get an iterator to list the content of a directory, with direct 301 * @brief Get an iterator to list the content of a directory, with direct
251 * information. 302 * information.
252 * 303 *