Enlightenment CVS committal
Author : lordchaos
Project : e17
Module : apps/evfs
Dir : e17/apps/evfs/src/bin
Modified Files:
evfs_main.c evfs_server_handle.c
Log Message:
* Drastic changes allowing a more generic VFS structure, and also allowing file
system operations between different file systems. This still needs a lot of
work, but a basic 'copy' function is already working
* Fixed the non-generic smb-stat problem. This will still be an issue with
multiple-client locking, but we'll deal with that later
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_main.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- evfs_main.c 11 Oct 2005 00:35:09 -0000 1.15
+++ evfs_main.c 16 Oct 2005 10:09:05 -0000 1.16
@@ -152,9 +152,6 @@
evfs_handle_file_rename_command(client,command);
break;
- case EVFS_CMD_COPY_FILE:
- printf("Copy file stub\n");
- break;
case EVFS_CMD_MOVE_FILE:
printf("Move file stub\n");
break;
@@ -168,6 +165,10 @@
evfs_handle_dir_list_command(client,command);
printf("List directory stub\n");
break;
+ case EVFS_CMD_FILE_COPY:
+ printf("File copy handler\n");
+ evfs_handle_file_copy(client,command);
+ break;
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/bin/evfs_server_handle.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evfs_server_handle.c 11 Oct 2005 00:35:09 -0000 1.7
+++ evfs_server_handle.c 16 Oct 2005 10:09:05 -0000 1.8
@@ -4,7 +4,6 @@
void evfs_handle_monitor_start_command(evfs_client* client, evfs_command*
command) {
/*First get the plugin responsible for this file*/
- void (*evfs_monitor_start)(evfs_client* client, evfs_command* command);
if (command->file_command.num_files > 0) {
evfs_plugin* plugin =
evfs_get_plugin_for_uri(command->file_command.files[0]->plugin_uri);
@@ -67,13 +66,18 @@
}
void evfs_handle_file_stat_command(evfs_client* client, evfs_command* command)
{
+ static struct stat file_stat;
+
printf ("At file stat handler\n");
printf("Looking for plugin for '%s'\n",
command->file_command.files[0]->plugin_uri);
evfs_plugin* plugin =
evfs_get_plugin_for_uri(command->file_command.files[0]->plugin_uri);
if (plugin) {
printf("Pointer here: %p\n", plugin->functions->evfs_file_stat);
- (*(plugin->functions->evfs_file_stat))(client,command);
+ (*(plugin->functions->evfs_file_stat))(command, &file_stat);
+
+ evfs_stat_event_create(client, command, &file_stat);
}
+ printf("Handled event, client is %p\n", client);
}
@@ -88,3 +92,60 @@
}
}
+
+void evfs_handle_file_copy(evfs_client* client, evfs_command* command) {
+ evfs_plugin* plugin;
+ evfs_plugin* dst_plugin;
+
+ char bytes[COPY_BLOCKSIZE];
+ long count;
+ long read_write_bytes = 0;
+ static struct stat file_stat;
+ evfs_filereference* ref = NEW(evfs_filereference);
+
+ printf ("At test handler\n");
+
+ /*Make a dummy 'to' file for now*/
+ /*ref->plugin_uri = strdup("smb");
+ ref->plugin = evfs_get_plugin_for_uri(ref->plugin_uri);
+ ref->parent = NULL;
+ ref->path = strdup("/gown/MythVideos/musicvideos/testcopy.dat");*/
+
+
+
+ plugin =
evfs_get_plugin_for_uri(command->file_command.files[0]->plugin_uri);
+ dst_plugin =
evfs_get_plugin_for_uri(command->file_command.files[1]->plugin_uri);
+
+ if (plugin && dst_plugin) {
+
(*dst_plugin->functions->evfs_file_create)(command->file_command.files[1]);
+
(*plugin->functions->evfs_file_open)(command->file_command.files[0]);
+
+ /*Get the source file size*/
+ (*plugin->functions->evfs_file_stat)(command, &file_stat);
+ printf("Source file size: %d bytes\n", file_stat.st_size);
+
+
+ count = 0;
+ while (count < file_stat.st_size) {
+
(*plugin->functions->evfs_file_seek)(command->file_command.files[0], count,
SEEK_SET);
+
+ read_write_bytes = (file_stat.st_size > count +
COPY_BLOCKSIZE) ? COPY_BLOCKSIZE : (file_stat.st_size - count);
+ printf("Reading/writing %d bytes\n", read_write_bytes);
+
+
(*plugin->functions->evfs_file_read)(command->file_command.files[0], bytes,
read_write_bytes );
+
+
(*dst_plugin->functions->evfs_file_write)(command->file_command.files[1],
bytes, read_write_bytes );
+
+
+
+ count+= COPY_BLOCKSIZE;
+ }
+
+
+
+
(*dst_plugin->functions->evfs_file_close)(command->file_command.files[1]);
+
(*plugin->functions->evfs_file_close)(command->file_command.files[0]);
+
+ }
+
+}
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs