Enlightenment CVS committal Author : lordchaos Project : e17 Module : apps/evfs
Dir : e17/apps/evfs/src/plugins Modified Files: evfs_fs_samba.c Log Message: * Added 'evfscat' - similar to unix cat. Allows such cool things as 'evfscat smb://host/filename.mpg | mplayer -cache 8192 -' to play videos from a remote filesystem * Client exposed versions of evfs_open/evfs_close/evfs_read etc * Integer fd support and hash mappings for remoting of file references to client =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/evfs/src/plugins/evfs_fs_samba.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -3 -r1.22 -r1.23 --- evfs_fs_samba.c 27 Nov 2005 01:34:13 -0000 1.22 +++ evfs_fs_samba.c 6 Dec 2005 06:16:59 -0000 1.23 @@ -45,6 +45,9 @@ static SMBCCTX *smb_context = NULL; Ecore_List* auth_cache; +int smb_next_fd; +Ecore_Hash* smb_fd_hash; + @@ -96,6 +99,27 @@ } +int smb_fd_get_next(void* ptr) { + smb_next_fd++; + ecore_hash_set(smb_fd_hash, (int*)smb_next_fd, ptr); + + printf("Wrote ptr %p for fd %d\n", ptr, smb_next_fd); + + return smb_next_fd; +} + +void* smb_fd_get_for_int(int fd) { + return ecore_hash_get(smb_fd_hash, (int*)fd); +} + + +void evfs_smb_populate_fd(evfs_filereference* file) { + if (file->fd_p == NULL) { + file->fd_p = smb_fd_get_for_int(file->fd); + } +} + + /*---------------------------------------------------------------------------*/ /*A temporary function until we build authentication into the protocol*/ void auth_fn(const char *server, const char *share, @@ -164,16 +188,14 @@ printf("Samba stat func at '%p'\n", &smb_evfs_file_stat); auth_cache = ecore_list_new(); + smb_fd_hash = ecore_hash_new(ecore_direct_hash, ecore_direct_compare); + smb_next_fd = 0; //Initialize samba (temporarily borrowed from gnomevfs) smb_context = smbc_new_context (); if (smb_context != NULL) { smb_context->debug = 0; - smb_context->callbacks.auth_fn = auth_fn; - /*smb_context->callbacks.add_cached_srv_fn = add_cached_server; - smb_context->callbacks.get_cached_srv_fn = get_cached_server; - smb_context->callbacks.remove_cached_srv_fn = remove_cached_server; - smb_context->callbacks.purge_cached_fn = purge_cached;*/ + smb_context->callbacks.auth_fn = auth_fn; if (!smbc_init_context (smb_context)) { printf("Error initializing samba context..\n"); @@ -185,8 +207,6 @@ return functions; - - } char* evfs_plugin_uri_get() { @@ -314,8 +334,9 @@ printf("Opening file '%s' in samba\n", dir_path); file->fd_p = smb_context->open(smb_context, dir_path, O_RDONLY, S_IRUSR); + file->fd = smb_fd_get_next(file->fd_p); - return 0; + return file->fd; } int evfs_file_close(evfs_filereference* file) { @@ -352,9 +373,11 @@ int evfs_file_read(evfs_client* client, evfs_filereference* file, char* bytes, long size) { int bytes_read = 0; /*printf("Reading %ld bytes from file %s\n", size, file->path);*/ + + evfs_smb_populate_fd(file); + //printf("FD Pointer: %p\n", file->fd_p); bytes_read = smb_context->read(smb_context, file->fd_p, bytes, size); - return bytes_read; } ------------------------------------------------------- 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://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs