Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/plugins Modified Files: evfs_fs_posix.c evfs_fs_sftp.c Log Message: * Victor Kojouharov's posix->file patch (cheers!) * Misc updates to sftp plugin =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/plugins/evfs_fs_posix.c,v retrieving revision 1.36 retrieving revision 1.37 diff -u -3 -r1.36 -r1.37 --- evfs_fs_posix.c 9 Feb 2006 11:54:53 -0000 1.36 +++ evfs_fs_posix.c 21 Feb 2006 10:44:08 -0000 1.37 @@ -80,7 +80,7 @@ evfs_plugin_functions * evfs_plugin_init() { - printf("Initialising the posix plugin..\n"); + printf("Initialising the file plugin..\n"); evfs_plugin_functions *functions = calloc(1, sizeof(evfs_plugin_functions)); posix_monitor_hash = ecore_hash_new(ecore_str_hash, ecore_str_compare); @@ -110,7 +110,7 @@ char * evfs_plugin_uri_get() { - return "posix"; + return "file"; } int @@ -204,7 +204,7 @@ printf(" Notifying client at id %ld of %s\n", mon->client->id, path); - evfs_file_monitor_event_create(mon->client, type, path, "posix"); /*Find a better way to do the plugin */ + evfs_file_monitor_event_create(mon->client, type, path, "file"); /*Find a better way to do the plugin */ /*We should really use an evfs_filereference here */ } } @@ -389,8 +389,14 @@ int evfs_file_stat(evfs_command * command, struct stat *file_stat, int file_number) { + int res; + //printf("Getting file stat...\n"); - int res = stat64(command->file_command.files[file_number]->path, file_stat); + #ifdef __USE_LARGEFILE64 + res = stat64(command->file_command.files[file_number]->path, file_stat); + #else + res = stat(command->file_command.files[file_number]->path, file_stat); + #endif if (!res) return EVFS_SUCCESS; @@ -530,7 +536,7 @@ } ref->path = strdup(full_name); - ref->plugin_uri = strdup("posix"); + ref->plugin_uri = strdup("file"); ecore_list_append(files, ref); } } =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/plugins/evfs_fs_sftp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- evfs_fs_sftp.c 10 Feb 2006 02:37:54 -0000 1.7 +++ evfs_fs_sftp.c 21 Feb 2006 10:44:08 -0000 1.8 @@ -192,11 +192,18 @@ SftpConnection* conn; } SftpOpenHandle; +void sftp_ohandle_destroy(SftpOpenHandle* o) +{ + if (o->sftp_handle) free(o->sftp_handle); + free(o); +} + typedef enum { STATUS_PROGRESS, STATUS_FINISHED, STATUS_ATTR, - STATUS_DATA + STATUS_DATA, + STATUS_CLOSE } SftpReadStatus; @@ -1012,7 +1019,42 @@ } int evfs_file_close(evfs_filereference * file) { - printf("SFTP_CLOSE: STUB\n"); + SftpConnection* conn; + char* host, *path; + int rid; + SftpGenericHandle* handle; + SftpOpenHandle* ohandle; + + + sftp_split_host_path(file->path, &host, &path); + + + if ( !(conn = sftp_get_connection_for_host(host))) { + conn = sftp_connect(host); + } + + while (conn->status == SFTP_INIT) { + ecore_main_loop_iterate(); + usleep(10); + } + + ohandle = ecore_hash_get(sftp_open_handles, (long*)file->fd); + if (ohandle) { + + //handle = sftp_file_close(ohandle); + while (! (handle->status == STATUS_FINISHED || handle->status == STATUS_CLOSE)) { + ecore_main_loop_iterate(); + usleep(2); + } + + free(host); + free(path); + ecore_hash_remove(sftp_open_handles, (long*)file->fd); + sftp_ohandle_destroy(ohandle); + } else { + printf("Could not find open file handle\n"); + } + } int evfs_file_write(evfs_filereference * file, char *bytes, long size) { ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs