summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore_file/ecore_file_private.h
blob: 95cc1c7e0900da2771aa0e82dd8901e19d1cf9ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#ifndef ECORE_FILE_PRIVATE_H_
#define ECORE_FILE_PRIVATE_H_

#ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS  64
#endif

#ifdef __linux__
# include <features.h>
#endif

#ifdef HAVE_EVIL
# include <Evil.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>

#include "Ecore.h"
#include "ecore_private.h"

#include "Ecore_File.h"

extern int _ecore_file_log_dom;

#ifdef ECORE_FILE_DEFAULT_LOG_COLOR
#undef ECORE_FILE_DEFAULT_LOG_COLOR
#endif
#define ECORE_FILE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE

#ifdef ERR
# undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_ecore_file_log_dom, __VA_ARGS__)

#ifdef DBG
# undef DBG
#endif
#define DBG(...) EINA_LOG_DOM_DBG(_ecore_file_log_dom, __VA_ARGS__)

#ifdef INF
# undef INF
#endif
#define INF(...) EINA_LOG_DOM_INFO(_ecore_file_log_dom, __VA_ARGS__)

#ifdef WRN
# undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_ecore_file_log_dom, __VA_ARGS__)

#ifdef CRIT
# undef CRIT
#endif
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_file_log_dom, __VA_ARGS__)

/* ecore_file_monitor */
int  ecore_file_monitor_init(void);
void ecore_file_monitor_shutdown(void);

#define ECORE_FILE_MONITOR(x) ((Ecore_File_Monitor *)(x))

typedef struct _Ecore_File Ecore_File;
struct _Ecore_File
{
   EINA_INLIST;
   char          *name;
   int            mtime;
   unsigned char  is_dir;
};

struct _Ecore_File_Monitor
{
   EINA_INLIST;
   void (*func) (void *data,
		 Ecore_File_Monitor *ecore_file_monitor,
		 Ecore_File_Event event,
		 const char *path);

   char               *path;
   void               *data;
   Ecore_File         *files;
};

typedef struct _Ecore_File_Iterator Ecore_File_Iterator;
struct _Ecore_File_Iterator
{
   Eina_Iterator iterator;

   DIR *dirp;
   int length;

   char dir[1];
};

#ifdef HAVE_INOTIFY
int                 ecore_file_monitor_inotify_init(void);
int                 ecore_file_monitor_inotify_shutdown(void);
Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path,
							void (*func) (void *data,
								      Ecore_File_Monitor *ecore_file_monitor,
								      Ecore_File_Event event,
								      const char *path),
							void *data);
void                ecore_file_monitor_inotify_del(Ecore_File_Monitor *ecore_file_monitor);
#endif
 
#ifdef HAVE_NOTIFY_WIN32
int                 ecore_file_monitor_win32_init(void);
int                 ecore_file_monitor_win32_shutdown(void);
Ecore_File_Monitor *ecore_file_monitor_win32_add(const char *path,
                                                 void      (*func) (void               *data,
                                                                    Ecore_File_Monitor *ecore_file_monitor,
                                                                    Ecore_File_Event    event,
                                                                    const char         *path),
                                                 void       *data);
void                ecore_file_monitor_win32_del(Ecore_File_Monitor *ecore_file_monitor);
#endif

#ifdef HAVE_POLL
int                 ecore_file_monitor_poll_init(void);
int                 ecore_file_monitor_poll_shutdown(void);
Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path,
						void (*func) (void *data,
							      Ecore_File_Monitor *ecore_file_monitor,
							      Ecore_File_Event event,
							      const char *path),
						void *data);
void                ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor);

#endif

/* ecore_file_path */
void ecore_file_path_init(void);
void ecore_file_path_shutdown(void);

/* ecore_file_download */
int  ecore_file_download_init(void);
void ecore_file_download_shutdown(void);

#endif