Enlightenment CVS committal

Author  : lordchaos
Project : e17
Module  : apps/efsd

Dir     : e17/apps/efsd/efsd


Modified Files:
        efsd_commands.c efsd_io.c efsd_main.c 


Log Message:
More work on EFSD.  If you run the demo with a real file as the argument, and 
watch the server debug output, command transmission/execution for EfsdFileCmds 
actually works now :)

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_commands.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- efsd_commands.c     6 Aug 2005 08:43:21 -0000       1.15
+++ efsd_commands.c     6 Aug 2005 12:28:23 -0000       1.16
@@ -73,9 +73,15 @@
 }
 
 
+#if HAVE_ECORE
 static int
 send_reply(EfsdCommand *cmd, int errorcode,
+          int data_len, void *data, Ecore_Ipc_Client* client)
+#else
+send_reply(EfsdCommand *cmd, int errorcode,
           int data_len, void *data, int client)
+#endif
+
 {
   EfsdEvent  ee;
   int        sockfd;
@@ -502,9 +508,12 @@
 
   D_ENTER;
 
+  printf ("ERR: Running get filetype on %s\n",cmd->efsd_file_cmd.files[0] );
+
   if (efsd_filetype_get(cmd->efsd_file_cmd.files[0], type, MAXPATHLEN))
     {
       D("FILE lookup succeded: %s\n", type);
+      printf("ERR: Type is %s\n", type);
       result = send_reply(cmd, 0, strlen(type)+1, type, client);
     }
   else
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_io.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -3 -r1.42 -r1.43
--- efsd_io.c   6 Aug 2005 08:43:21 -0000       1.42
+++ efsd_io.c   6 Aug 2005 12:28:23 -0000       1.43
@@ -882,6 +882,15 @@
          printf ("ERR: Writing filename %s\n", ec->efsd_file_cmd.files[i]);
          ecore_ipc_server_send(server, 1, 3, 0,0,0, 
ec->efsd_file_cmd.files[i], strlen(ec->efsd_file_cmd.files[i]) + 1); /*Catch 
the \0*/
   }
+
+  for (i = 0; i < ec->efsd_file_cmd.num_options; i++) {
+         printf ("ERR: Writing option\n", ec->efsd_file_cmd.options[i]);
+         ecore_ipc_server_send(server, 1, 4, 0,0,0, 
&ec->efsd_file_cmd.options[i], sizeof(EfsdOption)); /*Catch the \0*/
+  }
+
+  
+  ecore_ipc_server_send(server, 1, 100, 0,0,0, NULL, 0);
+  
   
   D_RETURN(0);
   #else
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/efsd/efsd/efsd_main.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -3 -r1.56 -r1.57
--- efsd_main.c 6 Aug 2005 08:43:22 -0000       1.56
+++ efsd_main.c 6 Aug 2005 12:28:23 -0000       1.57
@@ -178,22 +178,23 @@
    if ((e = (Ecore_Ipc_Event_Client_Data *) event))
    {
            if (e->major == 1) {
-                  /*ecore_ipc_client_send(e->client, 1, 6, e->ref, e->ref_to, 
5, NULL, 0);*/
-                  /*main_thread_launch(e->data, e->client);*/
-
                   printf ("   ERR: We have a command on our hands..\n");
 
                   if (e->minor == 1) {
+                         /*An efsdCommandType*/
+                          
                           printf("   ERR: Receiving command type, building a 
new EfsdCommand struct!\n");
                           ec = NEW(EfsdCommand);
 
-                          ec->type = *(EfsdCommandType*)(e->data);
+                          memcpy(&ec->type, e->data, sizeof(EfsdCommandType));
 
                           printf ("  ERR: Command type is %d\n", ec->type);
 
                           ecore_hash_set(partial_command_hash, e->client, ec);
                           
                   } else if (e->minor == 2) {
+                         /*An efsdCommandId*/
+                          
                           printf("   ERR: Receiving a command id\n");
 
                           /*Retrieve the inprogress event*/
@@ -201,11 +202,13 @@
 
                           printf ("  ERR: Our in-progress command has type 
%d\n", ec->type);
                        
-                          ec->efsd_file_cmd.id = *(EfsdCmdId*)(e->data);
+                          memcpy(&ec->efsd_file_cmd.id, e->data, 
sizeof(EfsdCmdId));
 
                           printf ("  ERR: Received command id %d\n", 
ec->efsd_file_cmd.id);
                           
                   } else if (e->minor == 3) {
+                         /*A file*/
+                          
                           printf ( "   ERR: Receiving a filename\n");
 
                           ec = ecore_hash_get(partial_command_hash, e->client);
@@ -218,15 +221,51 @@
                           } else {
                                   ec->efsd_file_cmd.files = 
realloc(ec->efsd_file_cmd.files, sizeof(char*) * 
(ec->efsd_file_cmd.num_files)+1);
                           }
-                          ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files] 
= (char*)(e->data);
+                          ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files] 
= strdup(e->data);
 
                           printf ("Received a filename\n, it is '%s'\n", 
ec->efsd_file_cmd.files[ec->efsd_file_cmd.num_files]);
 
                           ec->efsd_file_cmd.num_files+=1;
                           
-                  }
+                  } else if (e->minor == 4) {
+                          /*An efsdOption*/
+                          /*Basically two ints*/
+
+                          printf ( "   ERR: Receiving an option\n");
+
+                          ec = ecore_hash_get(partial_command_hash, e->client);
+
+                          if (!ec->efsd_file_cmd.num_options) {
+                                  ec->efsd_file_cmd.options = 
malloc(sizeof(EfsdOption));
+                          } else {
+                                  ec->efsd_file_cmd.options = 
realloc(ec->efsd_file_cmd.options, sizeof(EfsdOption) * 
ec->efsd_file_cmd.num_options+1);
+                          }
+
+
+                          
memcpy(&ec->efsd_file_cmd.options[ec->efsd_file_cmd.num_options], e->data, 
sizeof(EfsdOption));
+
+                          ec->efsd_file_cmd.num_options++;
+                 } else if (e->minor == 100) {
+                         /*Command finished.. process..*/
+
+                         printf("Command finished..processing..\n");
+                         
+
+                         ec = ecore_hash_get(partial_command_hash, e->client);
+
+                         printf ("Filename is '%s'\n", 
ec->efsd_file_cmd.files[0]);
+                         /*ecore_hash_remove(partial_command_hash, 
e->client);*/
+                         
+                         main_thread_launch(ec, e->client);
+                 }
+                                  
+
+                          
+                          
            }
    }
+
+   return 1;
 }
                                                                                
                          
                                                                                
                          
@@ -251,7 +290,7 @@
   container = NEW(EfsdCommandClientContainer);
   container->ecmd = ecmd;
   container->client = client;
-  container->threaded = TRUE;
+  container->threaded = 1;
 
 #if USE_THREADS
 
@@ -264,16 +303,20 @@
   
   pthread_mutex_unlock(&threadcount_mutex);
 
+
   if (container->threaded)
     {
       pthread_t thread;
 
       if (pthread_create(&thread, NULL, main_handle_client_command, container) 
!= 0)
        {
+         printf("No threads\n");
+               
          /* Couldn't create a thread -- run directly. */
          container->threaded = FALSE;
          main_handle_client_command(container);  
        }
+
     }
   else
     {
@@ -322,16 +365,27 @@
 {  
   EfsdCommandClientContainer *container = (EfsdCommandClientContainer *)data;
   EfsdCommand *command;
+  
+  printf ("0.6: Filename is '%s'\n", container->ecmd->efsd_file_cmd.files[0]);
+  
+ #if HAVE_ECORE 
+  Ecore_Ipc_Client* client;
+ #else
   int client;
+ #endif
  
   D_ENTER;
 
+
   if (container->threaded)
     main_thread_detach();
 
   command = container->ecmd;
+
+  
   client = container->client;
 
+
   switch (command->type)
     {
     case EFSD_CMD_REMOVE:




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to