Enlightenment CVS committal Author : chaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/bin Modified Files: Makefile.am evfs_main.c evfs_metadata.c evfs_metadata_db.c evfs_operation.c evfs_server_handle.c evfs_worker.c evfscat.c evfscopy.c Log Message: Phase 1 of EvfsIO rewrite/cleanup: * evfs_filereference -> EvfsFilereference * evfs_event -> EvfsEvent/hierarchy * Simplified IO model for EET comms client<->server * More sane accessor functions for command files * More logical concatenation of structs to serve multiple purposes * Speed improvements =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/Makefile.am,v retrieving revision 1.27 retrieving revision 1.28 diff -u -3 -r1.27 -r1.28 --- Makefile.am 11 Aug 2007 10:39:02 -0000 1.27 +++ Makefile.am 16 Aug 2007 11:31:16 -0000 1.28 @@ -15,6 +15,7 @@ $(top_srcdir)/src/common/evfs_io.c \ $(top_srcdir)/src/common/evfs_event_helper.c \ $(top_srcdir)/src/common/evfs_common.c \ + $(top_srcdir)/src/common/evfs_filereference.c \ evfs_server_handle.c \ evfs_operation.c \ evfs_operation_tasks.c \ @@ -31,6 +32,7 @@ $(top_srcdir)/src/common/evfs_io.c \ $(top_srcdir)/src/common/evfs_event_helper.c \ $(top_srcdir)/src/common/evfs_common.c \ + $(top_srcdir)/src/common/evfs_filereference.c \ evfs_server_handle.c \ evfs_operation.c \ evfs_operation_tasks.c \ =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_main.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -3 -r1.63 -r1.64 --- evfs_main.c 12 Aug 2007 09:12:00 -0000 1.63 +++ evfs_main.c 16 Aug 2007 11:31:16 -0000 1.64 @@ -141,7 +141,7 @@ /*Save a reference to this client, so we can allocate the worker child to * it when it calls back*/ - if (worker_client_waiter) { + if (worker_client_waiter) { client->worker_client = worker_client_waiter; ecore_hash_set(evfs_server_get()->worker_hash, worker_client_waiter, client); worker_client_waiter = NULL; @@ -213,13 +213,16 @@ evfs_client *client; /*Make sure we're not the worker server's event*/ - if (ecore_ipc_client_server_get(e->client) != server->ipc_server) return 1; + if (ecore_ipc_client_server_get(e->client) != server->ipc_server) { + printf("CLIENT DATA: Not a message for us...server %p != client server %p: Type: %d\n", server->ipc_server,ecore_ipc_client_server_get(e->client),e->major ); + return 1; + } client = evfs_client_get(e->client); /*Onsend to client's worker, if any*/ if (client->worker_client) { - /*printf("Onsending data to client..%d %d %d %d %d\n", e->major,e->minor,e->ref,e->ref_to,e->response,e->data, e->size );*/ + printf("Onsending data to client %p..%d %d %d %d %d\n", client->worker_client,e->major,e->minor,e->ref,e->ref_to,e->response,e->data, e->size ); ecore_ipc_client_send(client->worker_client,e->major,e->minor,e->ref,e->ref_to,e->response,e->data, e->size); } else { @@ -239,7 +242,10 @@ /*Make sure we're not the daemon server's event*/ if (ecore_ipc_client_server_get(e->client) != server->worker_server) return 1; - printf("New worker client to server..\n"); + /*We're going to be sending *quite* a lot of data*/ + ecore_ipc_client_data_size_max_set(e->client,1000000); + + printf("New worker client to server..%p\n", server->worker_server); if (client_worker_waiter) { printf("Client %p waiting for worker..\n", client_worker_waiter); @@ -285,7 +291,10 @@ int id; /*Make sure we're not the daemon server's event*/ - if (ecore_ipc_client_server_get(e->client) != server->worker_server) return 1; + if (ecore_ipc_client_server_get(e->client) != server->worker_server) { + printf("Not a message for us...server %p != client server %p: Type: %d\n", server->worker_server,ecore_ipc_client_server_get(e->client),e->major ); + return 1; + } //printf("WORKER: Unrecognised major: %d\n", e->major); // @@ -293,7 +302,8 @@ client = ecore_hash_get(evfs_server_get()->worker_hash, e->client); if (client) { - ecore_ipc_client_send(client->client, e->major,e->minor,e->ref,e->ref_to,e->response,e->data,e->size); + printf("Got worker message, sending to client: %d, %d, %d, %d\n",e->major,e->minor,e->ref,e->ref_to); + ecore_ipc_client_send(client->client, e->major,e->minor,client->id,e->ref_to,e->response,e->data,e->size); } else { printf("Cannot find client at ipc_worker_data\n"); } @@ -368,14 +378,14 @@ break; case EVFS_CMD_METADATA_FILE_SET: - printf("Key/value: %s -> %s\n", command->file_command.ref, command->file_command.ref2); + printf("Key/value: %s -> %s\n", command->file_command->ref, command->file_command->ref2); evfs_handle_metadata_string_file_set_command(client,command, - command->file_command.ref, command->file_command.ref2); + command->file_command->ref, command->file_command->ref2); break; case EVFS_CMD_METADATA_FILE_GET: - printf("Requested metadata retrieval.. key:%s\n", command->file_command.ref); + printf("Requested metadata retrieval.. key:%s\n", command->file_command->ref); evfs_handle_metadata_string_file_get_command(client,command, - command->file_command.ref); + command->file_command->ref); break; case EVFS_CMD_METADATA_GROUPS_GET: @@ -727,6 +737,9 @@ server->ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EVFS_IPC_TITLE, 0, NULL); + /*We're going to be sending *quite* a lot of data*/ + ecore_ipc_server_data_size_max_set(server->ipc_server,1000000); + client_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, ipc_client_add, NULL); client_del = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, ipc_client_del, @@ -734,8 +747,12 @@ client_data = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, ipc_client_data, NULL); + printf("Started IPC server %p for ipc_server\n", server->ipc_server); + server->worker_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, EVFS_WOR_TITLE, 0, NULL); + /*We're going to be sending *quite* a lot of data*/ + ecore_ipc_server_data_size_max_set(server->worker_server,1000000); worker_add = ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, ipc_worker_add, NULL); =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_metadata.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -3 -r1.35 -r1.36 --- evfs_metadata.c 13 Aug 2007 03:05:21 -0000 1.35 +++ evfs_metadata.c 16 Aug 2007 11:31:16 -0000 1.36 @@ -149,7 +149,7 @@ void evfs_metadata_debug_group_list_print() { Evas_List* l; - evfs_metadata_group_header* g; + EvfsMetadataGroup* g; printf("Printing group list:\n"); for (l = metadata_root->group_list; l; ) { @@ -166,7 +166,7 @@ void evfs_metadata_debug_file_groups_print(evfs_metadata_file_groups* groups) { Evas_List* l; - evfs_metadata_group_header* g; + EvfsMetadataGroup* g; printf("Printing group list:\n"); for (l = groups->groups; l; ) { @@ -180,16 +180,17 @@ } -void evfs_metadata_group_header_free(evfs_metadata_group_header* g) +void evfs_metadata_group_header_free(EvfsMetadataGroup* g) { if (g->name) free(g->name); if (g->description) free(g->description); + if (g->visualhint) free(g->visualhint); free(g); } void evfs_metadata_file_groups_free(evfs_metadata_file_groups* groups) { Evas_List* l; - evfs_metadata_group_header* g; + EvfsMetadataGroup* g; for (l = groups->groups; l; ) { g = l->data; @@ -203,7 +204,7 @@ int evfs_metadata_file_groups_group_check(evfs_metadata_file_groups* groups, char* group) { Evas_List* l; - evfs_metadata_group_header* g; + EvfsMetadataGroup* g; int ret = 0; for (l = groups->groups; l; ) { @@ -221,12 +222,12 @@ return ret; } -evfs_metadata_group_header* -evfs_metadata_group_header_new(char* name, char* desc) +EvfsMetadataGroup* +EvfsMetadataGroup_new(char* name, char* desc) { - evfs_metadata_group_header* group; + EvfsMetadataGroup* group; - group = calloc(1, sizeof(evfs_metadata_group_header)); + group = calloc(1, sizeof(EvfsMetadataGroup)); if (name) group->name = strdup(name); if (desc) group->description = strdup(desc); @@ -234,7 +235,7 @@ return group; } -int evfs_metadata_group_header_exists(char* group) +int EvfsMetadataGroup_exists(char* group) { char query[1024]; int exists = 0; @@ -267,7 +268,7 @@ char* data; int size; int ret; - evfs_filereference* ref; + EvfsFilereference* ref; if (!evfs_metadata_state) { evfs_metadata_state++; @@ -293,10 +294,10 @@ "value", value, EET_T_STRING); /*Group edd*/ - Evfs_Metadata_Group_Edd = _evfs_metadata_edd_create("evfs_metadata_group_header", sizeof(evfs_metadata_group_header)); - EET_DATA_DESCRIPTOR_ADD_BASIC(Evfs_Metadata_Group_Edd, evfs_metadata_group_header, + Evfs_Metadata_Group_Edd = _evfs_metadata_edd_create("EvfsMetadataGroup", sizeof(EvfsMetadataGroup)); + EET_DATA_DESCRIPTOR_ADD_BASIC(Evfs_Metadata_Group_Edd, EvfsMetadataGroup, "description", description, EET_T_STRING); - EET_DATA_DESCRIPTOR_ADD_BASIC(Evfs_Metadata_Group_Edd, evfs_metadata_group_header, + EET_DATA_DESCRIPTOR_ADD_BASIC(Evfs_Metadata_Group_Edd, EvfsMetadataGroup, "name", name, EET_T_STRING); /*Metadata group root*/ @@ -329,11 +330,11 @@ /*Create a starting 'group' list*/ metadata_root->group_list = evas_list_append(metadata_root->group_list, - evfs_metadata_group_header_new("Pictures", "Pictures")); + EvfsMetadataGroup_new("Pictures", "Pictures")); metadata_root->group_list = evas_list_append(metadata_root->group_list, - evfs_metadata_group_header_new("Video", "Video")); + EvfsMetadataGroup_new("Video", "Video")); metadata_root->group_list = evas_list_append(metadata_root->group_list, - evfs_metadata_group_header_new("Audio", "Audio")); + EvfsMetadataGroup_new("Audio", "Audio")); data = eet_data_descriptor_encode(Evfs_Metadata_Root_Edd, metadata_root, &size); ret = eet_write(_evfs_metadata_eet, EVFS_METADATA_GROUP_LIST, data, size, 0); @@ -364,7 +365,7 @@ evfs_metadata_db_init(&db); /*Setup the directory scan queue*/ - ref = NEW(evfs_filereference); + ref = NEW(EvfsFilereference); ref->plugin_uri = strdup("file"); ref->path = strdup(homedir); @@ -389,7 +390,7 @@ int ret; Evas_List* ret_list = NULL; sqlite3_stmt *pStmt; - evfs_metadata_group_header* g; + EvfsMetadataGroup* g; ret = sqlite3_prepare(db, "select name,visualHint from MetaGroup where parent = 0", -1, &pStmt, 0); @@ -399,7 +400,7 @@ if (ret == SQLITE_ROW) { - g = calloc(1, sizeof(evfs_metadata_group_header)); + g = calloc(1, sizeof(EvfsMetadataGroup)); g->name = strdup((char*)sqlite3_column_text(pStmt,0)); if (sqlite3_column_text(pStmt, 1)) { g->visualhint = strdup((char*)sqlite3_column_text(pStmt,1)); @@ -443,7 +444,7 @@ return ret_list; } -void evfs_metadata_group_header_file_add(evfs_filereference* ref, char* group) +void evfs_metadata_group_header_file_add(EvfsFilereference* ref, char* group) { char* file_path; int ret = 0; @@ -457,7 +458,7 @@ /*First make sure this group exists*/ - if ( (groupid = evfs_metadata_group_header_exists(group))) { + if ( (groupid = EvfsMetadataGroup_exists(group))) { printf("Group exists - proceed\n"); } else { printf("Alert - group not found\n"); @@ -465,7 +466,7 @@ } /*Build a path*/ - file_path = evfs_filereference_to_string(ref); + file_path = EvfsFilereference_to_string(ref); printf("File path is: %s\n", file_path); @@ -504,7 +505,7 @@ -void evfs_metadata_group_header_file_remove(evfs_filereference* ref, char* group) +void evfs_metadata_group_header_file_remove(EvfsFilereference* ref, char* group) { char* file_path; int ret = 0; @@ -518,7 +519,7 @@ /*First make sure this group exists*/ - if ( (groupid = evfs_metadata_group_header_exists(group))) { + if ( (groupid = EvfsMetadataGroup_exists(group))) { printf("Group exists - proceed\n"); } else { printf("Alert - group not found\n"); @@ -526,7 +527,7 @@ } /*Build a path*/ - file_path = evfs_filereference_to_string(ref); + file_path = EvfsFilereference_to_string(ref); printf("File path is: %s\n", file_path); @@ -563,7 +564,7 @@ -void evfs_metadata_file_set_key_value_string(evfs_filereference* ref, char* key, +void evfs_metadata_file_set_key_value_string(EvfsFilereference* ref, char* key, char* value) { evfs_metadata_object obj; @@ -574,7 +575,7 @@ int ret; /*Build a path*/ - file_path = evfs_filereference_to_string(ref); + file_path = EvfsFilereference_to_string(ref); snprintf(path, PATH_MAX, "/filedata/%s/custommeta/string/%s", file_path, key); _evfs_metadata_eet = eet_open(metadata_file, EET_FILE_MODE_READ_WRITE); @@ -598,7 +599,7 @@ eet_close(_evfs_metadata_eet); } -char* evfs_metadata_file_get_key_value_string(evfs_filereference* ref, char* key) +char* evfs_metadata_file_get_key_value_string(EvfsFilereference* ref, char* key) { evfs_metadata_object* obj = NULL; char path[PATH_MAX]; @@ -609,7 +610,7 @@ char* value = NULL; /*Build a path*/ - file_path = evfs_filereference_to_string(ref); + file_path = EvfsFilereference_to_string(ref); snprintf(path, PATH_MAX, "/filedata/%s/custommeta/string/%s", file_path, key); _evfs_metadata_eet = eet_open(metadata_file, EET_FILE_MODE_READ); @@ -640,15 +641,15 @@ /*----------------*/ /*This section defines the fork/grab part of the metadata system*/ -void evfs_metadata_extract_queue(evfs_filereference* ref) +void evfs_metadata_extract_queue(EvfsFilereference* ref) { /*At the moment, we only extract meta from posix folders*/ /*This may change, but we'll have to copy the file locally, * so libextractor can have a shot at it*/ if (!strcmp(ref->plugin_uri,"file")) { - evfs_filereference* clone; + EvfsFilereference* clone; - clone = evfs_filereference_clone(ref); + clone = EvfsFilereference_clone(ref); ecore_list_append(evfs_metadata_queue, clone); } } @@ -656,13 +657,13 @@ int evfs_metadata_scan_runner(void* data) { - evfs_filereference* ref; - evfs_filereference* iref; + EvfsFilereference* ref; + EvfsFilereference* iref; if ((ref = ecore_list_first_remove( evfs_metadata_directory_scan_queue))) { - evfs_filereference_sanitise(ref); + EvfsFilereference_sanitise(ref); if (ref->plugin) { Ecore_List* dir_list; evfs_command* c = evfs_file_command_single_build(ref); @@ -687,15 +688,15 @@ if (S_ISDIR(file_stat.st_mode)) { ecore_list_append(evfs_metadata_directory_scan_queue, iref); - free(ci->file_command.files); + evas_list_free(ci->file_command->files); free(ci); } else if (strstr(iref->path, ".mp3") || strstr(iref->path, ".jpg") || strstr(iref->path, ".mpg")) { ecore_list_append(evfs_metadata_queue, iref); - free(ci->file_command.files); + evas_list_free(ci->file_command->files); free(ci); } else { - evfs_cleanup_file_command(ci); + evfs_cleanup_command(ci, EVFS_CLEANUP_FREE_COMMAND); } } } @@ -742,7 +743,7 @@ handleCount++; /*printf("Filename: %s - ", str);*/ - evfs_filereference* file = evfs_parse_uri_single((char*)str); + EvfsFilereference* file = evfs_parse_uri_single((char*)str); if (file) { evfs_command* proxy; struct stat file_stat; @@ -795,7 +796,7 @@ int evfs_metadata_extract_runner(void* data) { - evfs_filereference* ref; + EvfsFilereference* ref; int status; int ret; @@ -830,7 +831,7 @@ return 1; } -int evfs_metadata_extract_fork(evfs_filereference* ref) +int evfs_metadata_extract_fork(EvfsFilereference* ref) { _metadata_fork = fork(); if (!_metadata_fork) { @@ -841,7 +842,7 @@ sqlite3* dbi; int file; Evas_List* l; - evfs_meta_obj* o; + EvfsMetaObject* o; ecore_main_loop_quit(); @@ -860,9 +861,7 @@ file = evfs_metadata_db_id_for_file(dbi,ref,1); if (file) { - command = NEW(evfs_command); - command->file_command.files = calloc(1, sizeof(evfs_filereference*)); - command->file_command.files[0] = ref; + command = evfs_file_command_single_build(ref); plugin = evfs_meta_plugin_get_for_type(evfs_server_get(), "object/undefined"); meta_list = (*EVFS_PLUGIN_META(plugin)->functions->evfs_file_meta_retrieve)(NULL,command); =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_metadata_db.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- evfs_metadata_db.c 26 Jun 2007 02:35:28 -0000 1.9 +++ evfs_metadata_db.c 16 Aug 2007 11:31:16 -0000 1.10 @@ -248,7 +248,7 @@ } -int evfs_metadata_db_id_for_file(sqlite3* db, evfs_filereference* ref, int create) +int evfs_metadata_db_id_for_file(sqlite3* db, EvfsFilereference* ref, int create) { char* file_path; char query[PATH_MAX]; @@ -258,7 +258,7 @@ /*Build a path*/ - file_path = evfs_filereference_to_string(ref); + file_path = EvfsFilereference_to_string(ref); /*printf("File path is: %s\n", file_path);*/ =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_operation.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- evfs_operation.c 25 Jul 2007 17:00:53 -0000 1.18 +++ evfs_operation.c 16 Aug 2007 11:31:16 -0000 1.19 @@ -115,7 +115,7 @@ /*Sub task functions*/ -void evfs_operation_copy_task_add(evfs_operation* op, evfs_filereference* file_from, evfs_filereference* file_to, struct stat from_stat, +void evfs_operation_copy_task_add(evfs_operation* op, EvfsFilereference* file_from, EvfsFilereference* file_to, struct stat from_stat, struct stat to_stat, int to_stat_response) { evfs_operation_files* fop = EVFS_OPERATION_FILES(op); @@ -137,7 +137,7 @@ ecore_list_append(op->sub_task, copy); } -void evfs_operation_remove_task_add(evfs_operation* op, evfs_filereference* file, struct stat file_stat) +void evfs_operation_remove_task_add(evfs_operation* op, EvfsFilereference* file, struct stat file_stat) { evfs_operation_files* fop = EVFS_OPERATION_FILES(op); evfs_operation_task_file_remove* remove = calloc(1, sizeof(evfs_operation_task_file_remove)); @@ -156,7 +156,7 @@ /*Sub task functions*/ -void evfs_operation_mkdir_task_add(evfs_operation* op, evfs_filereference* src, evfs_filereference* dir) +void evfs_operation_mkdir_task_add(evfs_operation* op, EvfsFilereference* src, EvfsFilereference* dir) { evfs_operation_files* fop = EVFS_OPERATION_FILES(op); evfs_operation_task_mkdir* mkdir = calloc(1, sizeof(evfs_operation_task_mkdir)); =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_server_handle.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -3 -r1.78 -r1.79 --- evfs_server_handle.c 13 Aug 2007 03:05:21 -0000 1.78 +++ evfs_server_handle.c 16 Aug 2007 11:31:16 -0000 1.79 @@ -16,7 +16,7 @@ /*Move these functions somewhere*/ int -evfs_uri_open(evfs_client * client, evfs_filereference * uri) +evfs_uri_open(evfs_client * client, EvfsFilereference * uri) { evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, uri->plugin_uri); @@ -34,7 +34,7 @@ } int -evfs_uri_close(evfs_client * client, evfs_filereference * uri) +evfs_uri_close(evfs_client * client, EvfsFilereference * uri) { evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, uri->plugin_uri); @@ -53,7 +53,7 @@ } int -evfs_uri_read(evfs_client * client, evfs_filereference * uri, char *bytes, +evfs_uri_read(evfs_client * client, EvfsFilereference * uri, char *bytes, long size) { evfs_plugin *plugin = @@ -77,11 +77,10 @@ { /*First get the plugin responsible for this file */ - if (command->file_command.num_files > 0) + if (command->file_command->num_files > 0) { evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (!plugin) { @@ -91,7 +90,7 @@ { printf ("Requesting a file monitor from this plugin for uri type '%s'\n", - command->file_command.files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_monitor_start) (client, command); } @@ -109,11 +108,10 @@ void (*evfs_monitor_start) (evfs_client * client, evfs_command * command); - if (command->file_command.num_files > 0) + if (evfs_command_file_count_get(command) > 0) { evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (!plugin) { @@ -123,7 +121,7 @@ { printf ("Requesting a file monitor end from this plugin for uri type '%s'\n", - command->file_command.files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); evfs_monitor_start = dlsym(plugin->dl_ref, EVFS_FUNCTION_MONITOR_STOP); @@ -155,8 +153,7 @@ evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_lstat) (command, &file_stat, 0); @@ -166,7 +163,7 @@ { evfs_operation_remove_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[0]), + EvfsFilereference_clone(evfs_command_first_file_get(command)), file_stat); } @@ -177,7 +174,7 @@ /*It's a directory, recurse into it */ Ecore_List *directory_list = NULL; - evfs_filereference *file = NULL; + EvfsFilereference *file = NULL; /*First, we need a directory list... */ (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_dir_list) (client, command, @@ -186,13 +183,7 @@ { while ((file = ecore_list_first_remove(directory_list))) { - evfs_command *recursive_command = NEW(evfs_command); - - recursive_command->file_command.files = - malloc(sizeof(evfs_filereference *) * 1); - recursive_command->type = EVFS_CMD_REMOVE_FILE; - recursive_command->file_command.files[0] = file; - recursive_command->file_command.num_files = 1; + evfs_command *recursive_command = evfs_file_command_single_build(file); evfs_handle_file_remove_command(client, recursive_command, root_command); @@ -203,7 +194,7 @@ } evfs_operation_remove_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[0]), + EvfsFilereference_clone(evfs_command_first_file_get(command)), file_stat); } @@ -211,7 +202,7 @@ { printf("Not recursing - LINK directory!\n"); evfs_operation_remove_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[0]), + EvfsFilereference_clone(evfs_command_first_file_get(command)), file_stat); } @@ -240,15 +231,14 @@ printf("At rename handle\n"); evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { printf("Pointer here: %p\n", EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_rename); if (EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_rename) { - if (command->file_command.num_files == 2) + if (evfs_command_file_count_get(command) == 2) (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_rename) (client, command); else printf("ERR: Wrong number of files to rename\n"); @@ -264,13 +254,12 @@ struct stat file_stat; evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin && EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_stat ) { (*(EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_stat)) (command, &file_stat, 0); - /*printf("Size: %lld for '%s'\n", file_stat.st_size, command->file_command.files[0]->path);*/ + /*printf("Size: %lld for '%s'\n", file_stat.st_size, command->file_command->files[0]->path);*/ evfs_stat_event_create(client, command, &file_stat); } @@ -282,18 +271,17 @@ printf("At file open handler\n"); printf("Looking for plugin for '%s'\n", - command->file_command.files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { printf("Pointer here: %p\n", EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_open); (*(EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_open)) (client, - command->file_command.files[0]); + evfs_command_first_file_get(command)); fprintf(stderr, "Opened file, fd is: %d\n", - command->file_command.files[0]->fd); + evfs_command_first_file_get(command)->fd); evfs_open_event_create(client, command); } @@ -305,23 +293,21 @@ char *bytes; int b_read = 0; - //printf ("At file read handler, fd is: %d\n", command->file_command.files[0]->fd); - //printf ("Reading %d bytes\n", command->file_command.extra); + //printf ("At file read handler, fd is: %d\n", command->file_command->files[0]->fd); + //printf ("Reading %d bytes\n", command->file_command->extra); - bytes = malloc(sizeof(char) * command->file_command.extra); + bytes = malloc(sizeof(char) * command->file_command->extra); - //printf("Looking for plugin for '%s'\n", command->file_command.files[0]->plugin_uri); + //printf("Looking for plugin for '%s'\n", command->file_command->files[0]->plugin_uri); evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { //printf("Pointer here: %p\n", EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_read); b_read = (*(EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_read)) (client, - command->file_command. - files[0], bytes, - command->file_command.extra); + evfs_command_first_file_get(command), bytes, + command->file_command->extra); //printf("Bytes read: %d\n", b_read); @@ -336,8 +322,7 @@ { evfs_plugin *plugin = evfs_get_plugin_for_uri(client->server, - command->file_command. - files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { Ecore_List *directory_list = NULL; (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_dir_list) (client, command, &directory_list); @@ -349,7 +334,7 @@ } } else { printf("No plugin for '%s'\n", - command->file_command.files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); } } @@ -362,14 +347,14 @@ plugin = evfs_get_plugin_for_uri(client->server, - command->file_command.files[0]->plugin_uri); + evfs_command_first_file_get(command)->plugin_uri); if (plugin) { printf("Making new directory '%s'", - command->file_command.files[0]->path); + evfs_command_first_file_get(command)->path); ret = - (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_mkdir) (command->file_command.files[0]); + (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_file_mkdir) (evfs_command_first_file_get(command)); printf("....ret was %d\n", ret); } } @@ -400,7 +385,7 @@ int res; evfs_operation_files *op; - num_files = command->file_command.num_files; + num_files = evfs_command_file_count_get(command); printf("Num files at copy: %d\n", num_files); /* < 2 files, no copy, dude */ @@ -411,7 +396,7 @@ dst_plugin = evfs_get_plugin_for_uri(client->server, - command->file_command.files[num_files-1]->plugin_uri); + evfs_command_nth_file_get(command, num_files-1)->plugin_uri); if (num_files > 2) { /*Check if >2 files, dest file is a dir*/ @@ -435,7 +420,7 @@ for (c_file=0;c_file < num_files - 1; c_file++) { plugin = evfs_get_plugin_for_uri(client->server, - command->file_command.files[c_file]->plugin_uri); + evfs_command_nth_file_get(command,c_file)->plugin_uri); if (plugin && dst_plugin) { @@ -459,26 +444,26 @@ (*EVFS_PLUGIN_FILE(dst_plugin)->functions->evfs_file_lstat) (command, &dest_stat, num_files-1); /*if (S_ISDIR(dest_stat.st_mode)) { - printf("Dest is a dir: %s\n", command->file_command.files[num_files-1]->path); + printf("Dest is a dir: %s\n", command->file_command->files[num_files-1]->path); printf("Res: %d\n", res); } else { - printf("Dest not a dir: %s://%s\n", command->file_command.files[num_files-1]->plugin_uri, - command->file_command.files[num_files-1]->path); + printf("Dest not a dir: %s://%s\n", command->file_command->files[num_files-1]->plugin_uri, + command->file_command->files[num_files-1]->path); printf("Res: %d\n", res); }*/ if (!S_ISDIR(file_stat.st_mode)) { - evfs_filereference* rewrite_dest = NULL; + EvfsFilereference* rewrite_dest = NULL; rewrite_dest = - evfs_filereference_clone(command->file_command.files[num_files-1]); + EvfsFilereference_clone(evfs_command_nth_file_get(command,num_files-1)); /*If dest_file exists, and is a dir - the dest file is rewritten * to be the original filename in the new dir*/ if (res == EVFS_SUCCESS && S_ISDIR(dest_stat.st_mode)) { evfs_command* new_command; int final_len; - char *slashpos = strrchr(command->file_command.files[c_file]->path, '/'); + char *slashpos = strrchr(evfs_command_nth_file_get(command,c_file)->path, '/'); printf("Filename is: %s\n", slashpos); @@ -486,10 +471,10 @@ char *path_to = malloc(final_len); - if (strcmp(command->file_command.files[num_files-1]->path, "/")) - snprintf(path_to, final_len , "%s%s", command->file_command.files[num_files-1]->path, slashpos); + if (strcmp(evfs_command_nth_file_get(command,num_files-1)->path, "/")) + snprintf(path_to, final_len , "%s%s", evfs_command_nth_file_get(command,num_files-1)->path, slashpos); else - snprintf(path_to, final_len , "%s%s", command->file_command.files[num_files-1]->path, slashpos+1); + snprintf(path_to, final_len , "%s%s", evfs_command_nth_file_get(command,num_files-1)->path, slashpos+1); printf("Multi file dest dir rewrite path: %s\n", path_to); free(rewrite_dest->path); @@ -505,7 +490,7 @@ if (!S_ISLNK(file_stat.st_mode)) { evfs_operation_copy_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[c_file]), + EvfsFilereference_clone(evfs_command_nth_file_get(command,c_file)), rewrite_dest, file_stat, dest_stat, res); @@ -517,7 +502,7 @@ /*If we're a move, queue the delete of this dir..*/ if (move) { evfs_operation_remove_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[c_file]), + EvfsFilereference_clone(evfs_command_nth_file_get(command,c_file)), file_stat); } @@ -527,13 +512,13 @@ int origlen; char* pos; - evfs_filereference* newdir_rewrite; + EvfsFilereference* newdir_rewrite; - newdir_rewrite = evfs_filereference_clone(command->file_command.files[num_files-1]); + newdir_rewrite = EvfsFilereference_clone(evfs_command_nth_file_get(command,num_files-1)); if (command == root_command && S_ISDIR(dest_stat.st_mode)) { origlen = strlen(newdir_rewrite->path); printf("Origlen is: %d (%s)\n", origlen, newdir_rewrite->path); - pos = strrchr(command->file_command.files[c_file]->path, '/'); + pos = strrchr(evfs_command_nth_file_get(command,c_file)->path, '/'); printf("String after pos: '%s'\n", pos+1); newlen = strlen(newdir_rewrite->path)+1+strlen(pos+1)+1; printf("Newlen is: %d\n", newlen); @@ -554,12 +539,12 @@ - evfs_operation_mkdir_task_add(EVFS_OPERATION(op), evfs_filereference_clone(command->file_command.files[c_file]), newdir_rewrite); + evfs_operation_mkdir_task_add(EVFS_OPERATION(op), EvfsFilereference_clone(evfs_command_nth_file_get(command,c_file)), newdir_rewrite); /*First, we need a directory list... */ /*We have to make a temp command - list expects first file in command to be list directory*/ - tmp_command = evfs_file_command_single_build(command->file_command.files[c_file]); + tmp_command = evfs_file_command_single_build(evfs_command_nth_file_get(command,c_file)); (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_dir_list) (client, tmp_command, &directory_list); @@ -567,12 +552,12 @@ evfs_cleanup_file_command(tmp_command); if (directory_list) { - evfs_filereference *file = NULL; + EvfsFilereference *file = NULL; while ((file = ecore_list_first_remove(directory_list))) { - evfs_filereference *source = NEW(evfs_filereference); - evfs_filereference *dest = NEW(evfs_filereference); - evfs_command *recursive_command = NEW(evfs_command); + EvfsFilereference *source = NEW(EvfsFilereference); + EvfsFilereference *dest = NEW(EvfsFilereference); + evfs_command *recursive_command; snprintf(destination_file, PATH_MAX, "%s%s", newdir_rewrite->path, @@ -580,19 +565,16 @@ source->path = strdup(file->path); source->plugin_uri = - strdup(command->file_command.files[c_file]->plugin_uri); + strdup(evfs_command_nth_file_get(command,c_file)->plugin_uri); source->parent = NULL; /*TODO - handle nested uris */ dest->path = strdup(destination_file); dest->plugin_uri = strdup(newdir_rewrite->plugin_uri); dest->parent = NULL; /*TODO - handle nested uris */ - recursive_command->file_command.files = - malloc(sizeof(evfs_filereference *) * 2); - recursive_command->type = EVFS_CMD_FILE_COPY; - recursive_command->file_command.files[0] = source; - recursive_command->file_command.files[1] = dest; - recursive_command->file_command.num_files = 2; + recursive_command = evfs_file_command_single_build(source); + evfs_file_command_file_add(recursive_command, dest); + recursive_command->type = EVFS_CMD_FILE_COPY; //printf("Copy file '%s' to %s\n", file->path, destination_file); @@ -608,7 +590,7 @@ /*If we're a move, queue the delete of this dir (it should be empty - unless perms denied it....*/ if (move) { evfs_operation_remove_task_add(EVFS_OPERATION(op), - evfs_filereference_clone(command->file_command.files[c_file]), + EvfsFilereference_clone(evfs_command_nth_file_get(command,c_file)), file_stat); } //if }// root_if @@ -616,8 +598,8 @@ } else { printf("Could not get plugins for both source and dest: (%s:%s)\n", - command->file_command.files[c_file]->plugin_uri, - command->file_command.files[num_files-1]->plugin_uri); + evfs_command_nth_file_get(command,c_file)->plugin_uri, + evfs_command_nth_file_get(command,num_files-1)->plugin_uri); } } //for loop if @@ -672,8 +654,8 @@ void evfs_handle_metadata_string_file_set_command(evfs_client* client __UNUSED__, evfs_command* command, char* key, char* value) { - if (command->file_command.num_files > 0) { - evfs_metadata_file_set_key_value_string(command->file_command.files[0], key, value); + if (command->file_command->num_files > 0) { + evfs_metadata_file_set_key_value_string(evfs_command_first_file_get(command), key, value); } } @@ -681,8 +663,8 @@ evfs_command* command, char* key) { char* value; - if (command->file_command.num_files > 0) { - value = evfs_metadata_file_get_key_value_string(command->file_command.files[0], key); + if (command->file_command->num_files > 0) { + value = evfs_metadata_file_get_key_value_string(evfs_command_first_file_get(command), key); } } @@ -698,15 +680,15 @@ void evfs_handle_metadata_file_group_add(evfs_client* client, evfs_command* command) { - if (command->file_command.num_files > 0) { - evfs_metadata_group_header_file_add(command->file_command.files[0], command->file_command.ref); + if (command->file_command->num_files > 0) { + evfs_metadata_group_header_file_add(evfs_command_first_file_get(command), command->file_command->ref); } } void evfs_handle_metadata_file_group_remove(evfs_client* client, evfs_command* command) { - if (command->file_command.num_files > 0) { - evfs_metadata_group_header_file_remove(command->file_command.files[0], command->file_command.ref); + if (command->file_command->num_files > 0) { + evfs_metadata_group_header_file_remove(evfs_command_first_file_get(command), command->file_command->ref); } } @@ -715,13 +697,13 @@ int c; Ecore_Desktop* desk; char path[PATH_MAX]; - evfs_filereference *ref, *src, *dest; + EvfsFilereference *ref, *src, *dest; char* pos; char* pos2; evfs_command* f_command; - for (c=0;c<command->file_command.num_files;c++) { - ref = command->file_command.files[c]; + for (c=0;c<command->file_command->num_files;c++) { + ref = evfs_command_nth_file_get(command,c); pos = strrchr(ref->path, '.'); pos2 = strrchr(ref->path, '/'); @@ -729,20 +711,17 @@ snprintf(path, PATH_MAX, "file://%s/", evfs_trash_files_dir_get()); strncat(path, pos2+1, strlen(pos2+1) - strlen(pos)); - printf("Parsing '%s'\n", command->file_command.files[c]->path); + printf("Parsing '%s'\n", evfs_command_nth_file_get(command,c)->path); /*Parse the ecore_desktop file*/ - desk = ecore_desktop_get(command->file_command.files[c]->path,NULL); + desk = ecore_desktop_get(evfs_command_nth_file_get(command,c)->path,NULL); src = evfs_parse_uri_single(path); dest = evfs_parse_uri_single(desk->path); - f_command = NEW(evfs_command); + f_command = evfs_file_command_single_build(src); + evfs_file_command_file_add(f_command, dest); f_command->type = EVFS_CMD_FILE_MOVE; - f_command->file_command.files = calloc(2, sizeof(evfs_filereference)); - f_command->file_command.files[0] = src; - f_command->file_command.files[1] = dest; - f_command->file_command.num_files = 2; printf("Original location: %s -- file: %s\n", desk->path, path); @@ -756,7 +735,7 @@ int ret = 0; plugin = - evfs_get_plugin_for_uri(client->server,command->file_command.files[0]->plugin_uri); + evfs_get_plugin_for_uri(client->server,evfs_command_first_file_get(command)->plugin_uri); if (plugin) { (*EVFS_PLUGIN_FILE(plugin)->functions->evfs_auth_push)(command); =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfs_worker.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evfs_worker.c 13 Aug 2007 03:05:21 -0000 1.2 +++ evfs_worker.c 16 Aug 2007 11:31:16 -0000 1.3 @@ -131,14 +131,14 @@ break; case EVFS_CMD_METADATA_FILE_SET: - printf("Key/value: %s -> %s\n", command->file_command.ref, command->file_command.ref2); + printf("Key/value: %s -> %s\n", command->file_command->ref, command->file_command->ref2); evfs_handle_metadata_string_file_set_command(client,command, - command->file_command.ref, command->file_command.ref2); + command->file_command->ref, command->file_command->ref2); break; case EVFS_CMD_METADATA_FILE_GET: - printf("Requested metadata retrieval.. key:%s\n", command->file_command.ref); + printf("Requested metadata retrieval.. key:%s\n", command->file_command->ref); evfs_handle_metadata_string_file_get_command(client,command, - command->file_command.ref); + command->file_command->ref); break; case EVFS_CMD_METADATA_GROUPS_GET: @@ -201,27 +201,23 @@ printf("Our parent client has disconnected, suicide time\n"); ecore_main_loop_quit(); } else { - /*printf("Got server data in fork!: PID: %d\n", getpid());*/ + evfs_command* command; + printf("Got server data in fork!: PID: %d\n", getpid()); ecore_ipc_message *msg = ecore_ipc_message_new(e->major, e->minor, e->ref, e->ref_to, e->response, e->data, e->size); - if (!worker_client->prog_command) { - worker_client->prog_command = evfs_command_new(); - } - /*True == command finished */ - if (evfs_process_incoming_command(evfs_server_get(), worker_client->prog_command, msg)) + if ((command = evfs_process_incoming_command(evfs_server_get(), msg))) { evfs_command_client *com_cli = NEW(evfs_command_client); com_cli->client = worker_client; - com_cli->command = worker_client->prog_command; - worker_client->prog_command = NULL; + com_cli->command = command; ecore_list_append(server->incoming_command_list, com_cli); - /*printf("Finished processing command in fork\n");*/ + printf("Finished processing command in fork\n"); } free(msg); @@ -529,8 +525,11 @@ NULL); worker_client->master = ecore_ipc_server_connect(ECORE_IPC_LOCAL_USER, EVFS_WOR_TITLE, 0, NULL); + /*We're going to be sending *quite* a lot of data*/ + ecore_ipc_server_data_size_max_set(worker_client->master,1000000); printf("Created new worker, ID: %d\n", worker_client->id); + printf("Connected to %p\n", worker_client->master); ecore_main_loop_begin(); return 0; =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfscat.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- evfscat.c 28 Dec 2006 17:00:02 -0000 1.6 +++ evfscat.c 16 Aug 2007 11:31:16 -0000 1.7 @@ -4,7 +4,7 @@ evfs_connection *con; void -callback(evfs_event * data, void *obj) +callback(EvfsEvent * data, void *obj) { switch (data->type) @@ -12,21 +12,20 @@ case EVFS_EV_FILE_OPEN: /* * printf("File open event..fd is %d, reading..\n", - * data->resp_command.file_command.files[0]->fd); + * data->resp_command.file_command->files[0]->fd); */ - evfs_client_file_read(con, data->resp_command.file_command.files[0], + evfs_client_file_read(con, evfs_command_first_file_get(data->command), 16384); break; case EVFS_EV_FILE_READ: //printf("File read event, size is %ld\n", data->data.size); - if (data->data.size > 0) + if (EVFS_EVENT_DATA(data)->size > 0) { - fwrite(data->data.bytes, data->data.size, 1, stdout); - evfs_client_file_read(con, - data->resp_command.file_command.files[0], + fwrite(EVFS_EVENT_DATA(data)->bytes, EVFS_EVENT_DATA(data)->size, 1, stdout); + evfs_client_file_read(con, evfs_command_first_file_get(data->command), 16384); } else =================================================================== RCS file: /cvs/e/e17/apps/evfs/src/bin/evfscopy.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- evfscopy.c 28 Dec 2006 17:00:02 -0000 1.2 +++ evfscopy.c 16 Aug 2007 11:31:16 -0000 1.3 @@ -4,7 +4,7 @@ evfs_connection *con; void -callback(evfs_event * data, void *obj) +callback(EvfsEvent * data, void *obj) { switch (data->type) @@ -12,7 +12,7 @@ case EVFS_EV_FILE_PROGRESS: printf("."); - if (data->progress->type == EVFS_PROGRESS_TYPE_DONE) { + if (EVFS_EVENT_PROGRESS(data)->type == EVFS_PROGRESS_TYPE_DONE) { evfs_disconnect(con); exit(0); } ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs