Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/common Modified Files: evfs_cleanup.c evfs_event_helper.c evfs_io.c Log Message: Pass the command we're dealing with back to the client =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/common/evfs_cleanup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evfs_cleanup.c 16 Aug 2005 09:00:20 -0000 1.2 +++ evfs_cleanup.c 8 Oct 2005 01:53:25 -0000 1.3 @@ -1,6 +1,8 @@ #include <evfs.h> void evfs_cleanup_command(evfs_command* command) { + printf("Cleaned command..\n"); + switch (command->type) { case EVFS_CMD_STARTMON_FILE: evfs_cleanup_file_command(command); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/common/evfs_event_helper.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- evfs_event_helper.c 7 Oct 2005 11:01:27 -0000 1.4 +++ evfs_event_helper.c 8 Oct 2005 01:53:25 -0000 1.5 @@ -14,7 +14,7 @@ event->file_monitor.fileev_type = type; event->file_monitor.filename_len = strlen(path)+1; - evfs_write_event(client, event); + evfs_write_event(client, NULL, event); /*Now destroy*/ free(event); @@ -23,7 +23,7 @@ } -void evfs_stat_event_create(evfs_client* client, struct stat* stat_obj) { +void evfs_stat_event_create(evfs_client* client, evfs_command* command, struct stat* stat_obj) { /*Create a reply event for a file mon event, send it , destroy event*/ evfs_event* event = NEW(evfs_event); @@ -31,7 +31,7 @@ memcpy(&event->stat.stat_obj, stat_obj, sizeof(struct stat)); - evfs_write_event(client, event); + evfs_write_event(client, command, event); /*Now destroy*/ free(event); =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/common/evfs_io.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- evfs_io.c 7 Oct 2005 11:01:27 -0000 1.11 +++ evfs_io.c 8 Oct 2005 01:53:25 -0000 1.12 @@ -45,13 +45,18 @@ -void evfs_write_event(evfs_client* client, evfs_event* event) { +void evfs_write_event(evfs_client* client, evfs_command* command, evfs_event* event) { evfs_write_ecore_ipc_client_message(client->client, ecore_ipc_message_new(EVFS_EV_REPLY,EVFS_EV_PART_TYPE,client->id,0,0,&event->type, sizeof(evfs_eventtype))); + /*Now write the source command, if any*/ + if (command) { + evfs_write_command_client(client,command); + } + switch (event->type) { case EVFS_EV_FILE_MONITOR: evfs_write_event_file_monitor(client,event); break; - case EVFS_EV_STAT: printf ("Writing stat event!\n"); + case EVFS_EV_STAT: evfs_write_stat_event(client,event); break; } @@ -63,6 +68,7 @@ int evfs_read_event(evfs_event* event, ecore_ipc_message* msg) { + switch (msg->minor) { case EVFS_EV_PART_TYPE: memcpy(&event->type, msg->data, sizeof(evfs_eventtype)); @@ -76,13 +82,23 @@ break; case EVFS_EV_PART_STAT_SIZE: memcpy(&event->stat.stat_obj, msg->data, sizeof(struct stat)); - printf("Received event , stat size: %ld\n", ((struct stat*)msg->data)->st_size); break; + + + /*The pieces of the incoming command*/ + case EVFS_COMMAND_TYPE: + case EVFS_FILE_REFERENCE: + case EVFS_COMMAND_END: + evfs_process_incoming_command(&event->resp_command, msg); + break; + + case EVFS_EV_PART_END: return TRUE; break; } + return FALSE; } @@ -112,6 +128,9 @@ } +/*------------------------------------------------------------------------*/ +//Some ugly duplication here - maybe we should consider reworking this so it can +//be generic void evfs_write_command(evfs_connection* conn, evfs_command* command) { @@ -127,23 +146,46 @@ } +void evfs_write_command_client(evfs_client* client, evfs_command* command) { + switch (command->type) { + case EVFS_CMD_STOPMON_FILE: + case EVFS_CMD_STARTMON_FILE: + case EVFS_CMD_REMOVE_FILE: + case EVFS_CMD_RENAME_FILE: + case EVFS_CMD_FILE_STAT: + evfs_write_file_command_client(client, command); + break; + } +} + void evfs_write_command_end(evfs_connection* conn) { evfs_write_ecore_ipc_server_message(conn->server, ecore_ipc_message_new(EVFS_COMMAND, EVFS_COMMAND_END, 0,0,0,NULL,0)); } +void evfs_write_command_end_client(evfs_client* client) { + evfs_write_ecore_ipc_client_message(client->client, ecore_ipc_message_new(EVFS_COMMAND, EVFS_COMMAND_END, client->id,0,0,NULL,0)); +} + void evfs_write_file_command(evfs_connection* conn, evfs_command* command) { int i; char uri[1024]; /*Write the command type structure*/ - evfs_write_ecore_ipc_server_message(conn->server, ecore_ipc_message_new(EVFS_COMMAND, EVFS_COMMAND_TYPE, 0,0,0,&command->type, sizeof(evfs_command_type))); + evfs_write_ecore_ipc_server_message(conn->server, + ecore_ipc_message_new(EVFS_COMMAND, EVFS_COMMAND_TYPE, 0,0,0, + &command->type, sizeof(evfs_command_type))); /*Write the files*/ /*Send them de-parsed to save time*/ for (i=0;i<command->file_command.num_files;i++) { - snprintf(uri, 1024, "%s://%s", command->file_command.files[i]->plugin_uri, command->file_command.files[i]->path); - evfs_write_ecore_ipc_server_message(conn->server, ecore_ipc_message_new(EVFS_COMMAND, EVFS_FILE_REFERENCE, 0,0,0,uri, sizeof(uri))); + snprintf(uri, 1024, "%s://%s", + command->file_command.files[i]->plugin_uri, + command->file_command.files[i]->path); + + evfs_write_ecore_ipc_server_message(conn->server, + ecore_ipc_message_new(EVFS_COMMAND, + EVFS_FILE_REFERENCE, 0,0,0,uri, sizeof(uri))); } /*Send a final*/ @@ -151,6 +193,36 @@ } + +void evfs_write_file_command_client(evfs_client* client, evfs_command* command) { + int i; + char uri[1024]; + + + /*Write the command type structure*/ + evfs_write_ecore_ipc_client_message(client->client, + ecore_ipc_message_new(EVFS_COMMAND, EVFS_COMMAND_TYPE, client->id,0,0, + &command->type, sizeof(evfs_command_type))); + + /*Write the files*/ + /*Send them de-parsed to save time*/ + for (i=0;i<command->file_command.num_files;i++) { + snprintf(uri, 1024, "%s://%s", + command->file_command.files[i]->plugin_uri, + command->file_command.files[i]->path); + + + evfs_write_ecore_ipc_client_message(client->client, + ecore_ipc_message_new(EVFS_COMMAND, + EVFS_FILE_REFERENCE, client->id,0,0,uri, sizeof(uri))); + } + + /*Send a final*/ + evfs_write_command_end_client(client); + + +} + /*----------------------------*/ @@ -166,14 +238,19 @@ break; case EVFS_FILE_REFERENCE: { + evfs_file_uri_path* path = evfs_parse_uri(message->data); if (command->file_command.num_files == 0) { command->file_command.num_files = 1; command->file_command.files = malloc(sizeof(evfs_filereference*)); command->file_command.files[0] = path->files[0]; + + + free(path); } else { + //printf("we already have %d files\n", command->file_command.num_files); /*TODO Handle multiple files*/ ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs