Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : apps/efsd
Dir : e17/apps/efsd/efsd
Modified Files:
efsd_commands.c efsd_commands.h efsd_io.c efsd_main.c
efsd_monitor.c efsd_monitor.h libefsd.c
Log Message:
Work on EFSD_FILECHANGE events
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_commands.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- efsd_commands.c 8 Aug 2005 12:26:31 -0000 1.18
+++ efsd_commands.c 9 Aug 2005 05:25:12 -0000 1.19
@@ -367,12 +367,14 @@
int
-efsd_command_start_monitor(EfsdCommand *cmd, int client, int dir_mode)
+efsd_command_start_monitor(EfsdCommand *cmd, Ecore_Ipc_Client* client, int
dir_mode)
{
int i, do_sort = FALSE;
D_ENTER;
+ D("Creating monitor command..\n");
+
for (i = 0; i < cmd->efsd_file_cmd.num_options; i++)
{
if (cmd->efsd_file_cmd.options[i].type == EFSD_OP_SORT)
@@ -382,7 +384,7 @@
}
}
-
+ printf("Starting monitoring on %p\n", client);
if (efsd_monitor_start(cmd, client, dir_mode, do_sort) == NULL)
{
errno_check(__LINE__, __FUNCTION__);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_commands.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- efsd_commands.h 6 Aug 2005 08:43:21 -0000 1.5
+++ efsd_commands.h 9 Aug 2005 05:25:12 -0000 1.6
@@ -36,7 +36,7 @@
int efsd_command_set_metadata(EfsdCommand *cmd, int client);
int efsd_command_get_metadata(EfsdCommand *cmd, int client);
int efsd_command_listdir(EfsdCommand *cmd, int client);
-int efsd_command_start_monitor(EfsdCommand *cmd, int client, int dir_mode);
+int efsd_command_start_monitor(EfsdCommand *cmd, Ecore_Ipc_Client* client,
int dir_mode);
int efsd_command_stop_monitor(EfsdCommand *cmd, int client, int dir_mode);
int efsd_command_start_monitor_metadata(EfsdCommand *cmd, int client);
int efsd_command_stop_monitor_metadata(EfsdCommand *cmd, int client);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -3 -r1.48 -r1.49
--- efsd_io.c 8 Aug 2005 12:26:31 -0000 1.48
+++ efsd_io.c 9 Aug 2005 05:25:12 -0000 1.49
@@ -108,6 +108,7 @@
if (!ec->efsd_file_cmd.num_files) {
ec->efsd_file_cmd.files =
malloc(sizeof(char*));
} else {
+ printf("Allocating space for %d files\n",
(ec->efsd_file_cmd.num_files)+1);
ec->efsd_file_cmd.files =
realloc(ec->efsd_file_cmd.files, sizeof(char*) *
(ec->efsd_file_cmd.num_files)+1);
}
ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files] = strdup(msg->data);
@@ -157,7 +158,7 @@
static void fill_set_metadata_cmd(EfsdIOV *iov, EfsdCommand *ec);
static void fill_get_metadata_cmd(EfsdIOV *iov, EfsdCommand *ec);
static void fill_close_cmd(EfsdIOV *iov, EfsdCommand *ec);
-static void fill_filechange_event(EfsdIOV *iov, EfsdEvent *ee);
+static Ecore_List* fill_filechange_event(EfsdIOV *iov, EfsdEvent *ee);
static void fill_metadata_change_event(EfsdIOV *iov, EfsdEvent *ee);
#if HAVE_ECORE
@@ -767,14 +768,18 @@
}
-static void
+static Ecore_List*
fill_filechange_event(EfsdIOV *iov, EfsdEvent *ee)
{
+ Ecore_List* el;
+
D_ENTER;
- iov->dat[iov->d] = strlen(ee->efsd_filechange_event.file) + 1;
+ el = ecore_list_new();
+ ecore_list_append(el, ecore_ipc_message_new(3, 1,
0,0,0,ee->efsd_filechange_event.file, strlen(ee->efsd_filechange_event.file)));
+ /*iov->dat[iov->d] = strlen(ee->efsd_filechange_event.file) + 1;*/
- iov->vec[iov->v].iov_base = &ee->type;
+ /*iov->vec[iov->v].iov_base = &ee->type;
iov->vec[iov->v].iov_len = sizeof(EfsdEventType);
iov->vec[++iov->v].iov_base = &ee->efsd_filechange_event.id;
iov->vec[iov->v].iov_len = sizeof(EfsdCmdId);
@@ -786,7 +791,11 @@
iov->vec[iov->v].iov_len = iov->dat[iov->d];
iov->d++;
- iov->v++;
+ iov->v++;*/
+
+ return el;
+
+
D_RETURN;
}
@@ -861,7 +870,7 @@
ecore_list_append(el, ecore_ipc_message_new(2, 1, 0,0,0,&ee->type,
sizeof(EfsdEventType)));
printf("Reply event data: %s\n", ee->efsd_reply_event.data);
- ecore_list_append(el, ecore_ipc_message_new(2, 2,
0,0,0,ee->efsd_reply_event.data, strlen(ee->efsd_reply_event.data)));
+ ecore_list_append(el, ecore_ipc_message_new(2, 2,
0,0,0,ee->efsd_reply_event.data, ee->efsd_reply_event.data_len));
ecore_list_append(el, ecore_ipc_message_new(2,100,0,0,0,NULL,0));
@@ -907,12 +916,15 @@
switch (ee->type)
{
case EFSD_EVENT_FILECHANGE:
- fill_filechange_event(NULL, ee);
+ printf("Sending a filechange\n");
+ return fill_filechange_event(NULL, ee);
break;
case EFSD_EVENT_METADATA_CHANGE:
+ printf("Sending a metadata\n");
fill_metadata_change_event(NULL, ee);
break;
case EFSD_EVENT_REPLY:
+ printf("Sending a reply\n");
return fill_reply_event(ee);
break;
default:
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_main.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- efsd_main.c 8 Aug 2005 03:37:26 -0000 1.59
+++ efsd_main.c 9 Aug 2005 05:25:12 -0000 1.60
@@ -424,6 +424,7 @@
D("Handling INVALID command\n");
}
+ ecore_hash_remove(partial_command_hash, client);
efsd_cmd_free(command);
#if USE_THREADS
@@ -649,11 +650,14 @@
}
}
+ #if HAVE_ECORE
+ #else
if (clientfd[emr->client] < 0)
{
D("Warning -- client %i's file descriptor seems to be closed.\n",
emr->client);
continue;
}
+ #endif
/* The famev.filename is not always
canonical. Let's build one that is.
@@ -689,6 +693,7 @@
efsd_stat_remove(famev_filename_canonical, TRUE);
}
+ printf("Client is %p, internal is %p\n", emr->client,
EFSD_CLIENT_INTERNAL);
if (emr->client == EFSD_CLIENT_INTERNAL)
{
if ((famev.code == FAMChanged) || (famev.code == FAMCreated))
@@ -734,6 +739,8 @@
/* Let's look only at the files we wanted: */
if (list_all_files ||
!efsd_misc_file_is_dotfile(famev.filename))
{
+ printf("1\n");
+ printf("Client is %p\n", emr->client);
efsd_monitor_send_filechange_event(m, emr, famev.code,
famev.filename);
}
}
@@ -754,6 +761,7 @@
{
if ((list_all_files ||
!efsd_misc_file_is_dotfile(filename)))
{
+ printf("2\n");
efsd_monitor_send_filechange_event(m, emr,
EFSD_FILE_EXISTS, filename);
}
@@ -761,6 +769,7 @@
}
/* Send FILE_END_EXISTS so that the client knows that the
end is reached. */
+ printf("3\n");
efsd_monitor_send_filechange_event(m, emr,
EFSD_FILE_END_EXISTS, famev.filename);
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_monitor.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- efsd_monitor.c 14 May 2002 09:46:18 -0000 1.24
+++ efsd_monitor.c 9 Aug 2005 05:25:12 -0000 1.25
@@ -61,7 +61,7 @@
EfsdMonitorKey;
/* Allocator and deallocator for a Monitor */
-static EfsdMonitor *monitor_new(EfsdCommand *com, int client,
+static EfsdMonitor *monitor_new(EfsdCommand *com, Ecore_Ipc_Client*
client,
int dir_mode, int is_temporary,
int is_sorted);
static void monitor_free(EfsdMonitor *m);
@@ -70,7 +70,7 @@
/* Increment use count for file monitor, or start
new monitor if file is not monitored yet.
*/
-static int monitor_add_client(EfsdMonitor *m, EfsdCommand
*com, int client);
+static int monitor_add_client(EfsdMonitor *m, EfsdCommand
*com, Ecore_Ipc_Client* client);
/* Returns list item containing monitoring request as data,
if monitor contains request by client CLIENT:
@@ -172,7 +172,7 @@
static EfsdMonitor *
-monitor_new(EfsdCommand *com, int client, int dir_mode, int is_temporary, int
is_sorted)
+monitor_new(EfsdCommand *com, Ecore_Ipc_Client* client, int dir_mode, int
is_temporary, int is_sorted)
{
EfsdMonitorRequest *emr;
EfsdMonitor *m;
@@ -294,7 +294,7 @@
EfsdMonitorRequest *
-efsd_monitor_request_new(int client, EfsdFileCmd *cmd)
+efsd_monitor_request_new(Ecore_Ipc_Client* client, EfsdFileCmd *cmd)
{
EfsdMonitorRequest *emr;
@@ -303,6 +303,7 @@
emr = NEW(EfsdMonitorRequest);
memset(emr, 0, sizeof(EfsdMonitorRequest));
+ printf("Seting client id to %p\n", client);
emr->client = client;
emr->id = cmd->id;
@@ -382,6 +383,7 @@
{
if ((list_all_files || !efsd_misc_file_is_dotfile(filename)))
{
+ printf("4\n");
efsd_monitor_send_filechange_event(m, emr, EFSD_FILE_EXISTS,
filename);
}
@@ -389,10 +391,12 @@
}
/* Send FILE_END_EXISTS so that the client knows that the end is
reached. */
+ printf("5\n");
efsd_monitor_send_filechange_event(m, emr, EFSD_FILE_END_EXISTS,
m->filename);
}
else
{
+ printf("6\n");
efsd_monitor_send_filechange_event(m, emr, EFSD_FILE_EXISTS,
m->filename);
efsd_monitor_send_filechange_event(m, emr, EFSD_FILE_END_EXISTS,
m->filename);
}
@@ -400,7 +404,7 @@
static int
-monitor_add_client(EfsdMonitor *m, EfsdCommand *com, int client)
+monitor_add_client(EfsdMonitor *m, EfsdCommand *com, Ecore_Ipc_Client* client)
{
EfsdList *l = NULL;
EfsdMonitorRequest *emr;
@@ -415,15 +419,19 @@
if (((EfsdMonitorRequest*)efsd_list_data(l))->client == client)
{
LOCK(&m->use_count_mutex);
+ printf("Client is %p, interal is %p\n", client, EFSD_CLIENT_INTERNAL);
if (client == EFSD_CLIENT_INTERNAL)
{
m->internal_use_count++;
+ printf("No event raised..\n");
D("Incrementing internal use count for monitoring file %s, now
(%i/%i).\n",
m->filename, m->internal_use_count, m->client_use_count);
}
else
{
+ printf("event raised..\n");
+ printf("7\n");
efsd_monitor_send_filechange_events(m,
(EfsdMonitorRequest*)efsd_list_data(l));
D("Client %i already monitors %s\n", client, m->filename);
}
@@ -456,7 +464,8 @@
if (client == EFSD_CLIENT_INTERNAL)
D_RETURN_(TRUE);
-
+
+ printf("8\n");
efsd_monitor_send_filechange_events(m, emr);
D_RETURN_(TRUE);
@@ -626,7 +635,7 @@
EfsdMonitor *
-efsd_monitor_start(EfsdCommand *com, int client, int dir_mode, int do_sort)
+efsd_monitor_start(EfsdCommand *com, Ecore_Ipc_Client* client, int dir_mode,
int do_sort)
{
EfsdMonitor *m = NULL;
@@ -894,6 +903,8 @@
D_ENTER;
+ printf("Running filechange on client %p\n", emr->client);
+
memset(&ee, 0, sizeof(EfsdEvent));
ee.type = EFSD_EVENT_FILECHANGE;
ee.efsd_filechange_event.changetype = type;
@@ -906,7 +917,8 @@
famev.code, emr->client);
*/
- if (efsd_io_write_event(efsd_main_get_fd(emr->client), &ee) < 0)
+
+ if (efsd_io_write_event(emr->client, &ee) < 0)
{
if (errno == EPIPE)
{
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_monitor.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- efsd_monitor.h 26 Nov 2001 01:06:38 -0000 1.11
+++ efsd_monitor.h 9 Aug 2005 05:25:12 -0000 1.12
@@ -37,7 +37,7 @@
typedef struct efsd_monitor_request
{
- int client;
+ Ecore_Ipc_Client* client;
EfsdCmdId id;
int num_options;
@@ -118,7 +118,7 @@
void efsd_monitor_init(void);
void efsd_monitor_cleanup(void);
-EfsdMonitorRequest *efsd_monitor_request_new(int client, EfsdFileCmd *cmd);
+EfsdMonitorRequest *efsd_monitor_request_new(Ecore_Ipc_Client* client,
EfsdFileCmd *cmd);
void efsd_monitor_request_free(EfsdMonitorRequest *emr);
@@ -130,7 +130,7 @@
/* High-level API for monitoring stuff -- refcounting
& co are handled inside. Return >= 0 on success.
*/
-EfsdMonitor *efsd_monitor_start(EfsdCommand *cmd, int client, int
dir_mode, int sort);
+EfsdMonitor *efsd_monitor_start(EfsdCommand *cmd, Ecore_Ipc_Client*
client, int dir_mode, int sort);
int efsd_monitor_stop(EfsdCommand *cmd, int client, int dir_mode);
/* For internal monitoring of files -- specify file name directly.
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/libefsd.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- libefsd.c 8 Aug 2005 12:26:32 -0000 1.62
+++ libefsd.c 9 Aug 2005 05:25:12 -0000 1.63
@@ -259,6 +259,8 @@
D_ENTER;
/*printf("ERR: libefsd_send_command to ecore efsd_io_write_command\n");*/
+ printf("Sending command..\n");
+ D("Sending command..\n");
if (!ec || !com)
D_RETURN_(-1);
@@ -312,6 +314,8 @@
EfsdCmdId id;
D_ENTER;
+
+ printf("File_cmd_absol\n");
/* Array gets freed in efsd_cmd_cleanup() ... */
full_files = malloc(sizeof(char*) * num_files);
@@ -338,7 +342,7 @@
full_files = realloc(full_files, sizeof(char*) * used_files);
}
- /*printf("ERR: Libefsd file_cmd_absolute\n");*/
+ printf("ERR: Libefsd file_cmd_absolute\n");
id = libefsd_file_cmd(ec, type, used_files, full_files, num_options, ops);
D_RETURN_(id);
@@ -355,8 +359,15 @@
D_ENTER;
- if (!ec || !files)
+ if (!ec) {
+ printf("Connection dead\n");
D_RETURN_(-1);
+ }
+
+ if (!files) {
+ printf("No files\n");
+ D_RETURN_(-1);
+ }
memset(&cmd, 0, sizeof(EfsdCommand));
@@ -374,7 +385,7 @@
/* And send it! */
- /*printf("ERR: Libefsd file_cmd\n");*/
+ printf("ERR: Libefsd file_cmd\n");
if (libefsd_send_command(ec, &cmd) < 0)
{
efsd_cmd_cleanup(&cmd);
@@ -1251,21 +1262,33 @@
D_ENTER;
- if (lstat(filename, &st) < 0)
+ printf("Exe start monitor..\n");
+
+ if (lstat(filename, &st) < 0) {
+ printf("Filename doesn't exist\n");
D_RETURN_(-1);
+ }
- if (dir_mode && !S_ISDIR(st.st_mode))
+ if (dir_mode && !S_ISDIR(st.st_mode)) {
+ printf("Dir request to non dir\n");
D_RETURN_(-1);
+ }
if (dir_mode)
type = EFSD_CMD_STARTMON_DIR;
else
type = EFSD_CMD_STARTMON_FILE;
- if (ops)
+
+ printf("Still here\n");
+ if (ops) {
+ printf("File cmd absol - options\n");
+ if (!ec) { printf ("Conn dead\n"); }
result = libefsd_file_cmd_absolute(ec, type, 1, &filename, ops->num_used,
ops->ops);
- else
+ } else {
+ printf("File cmd absol - no options\n");
result = libefsd_file_cmd_absolute(ec, type, 1, &filename, 0, NULL);
+ }
FREE(ops);
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs