Re: [patch] Synchronization of the panels

2005-04-08 Thread Pavel Tsekov
Hello,

On Sat, 2 Apr 2005, Siver Andrey wrote:

 I've rewriten my previous patch (main.c.diff, sync.inc):
 1) Now synchronization is doing by time (SYNC_DELAY keeps inverval in 
 seconds; 2 secs by default);
 2) The synchronization is loosing for some DLG_ signals for efficiency;
 3) Add some errors checks.

 It looks a little more stable and faster.

 But there is some MC behaviour that I could not understand or explain
 now. After some numbers of the update calls (3-5 and more), enter key
 does not work any longer for any directory of the panel opposited to the
 updating: error occurs: cannot change directory. 'magic_path' function
 does not detect any problem though. I do not know whether it due to my
 patch, or due to MC or system property.
 Also it looks like my patch behaviour depends on type of terminal...
 Please test it.

 For those who possesses configure magic I also prepared patches for
 main.h and configure.ac (I also registered enable-synchro option; it

The configure patch is pretty simplistic - much more have to be done. I'll
try to help with that.

 will be useful until patch become stable); you may use sync4.h and
 sync4.c also. Unfortunately I'm not such a person now :).

Please, do not send two different sets of files for the same thing i.e.
sync4.* and sync.inc. You should switch to sync4.c and sync4.h.

 Suggestions are welcome.

Ok - several points:


1) Have you tested your patch with `auto_menu' set to 1 ? From what I see
   by reading your patch you're forcing the code to send DLG_IDLE here:

if (msg != DLG_IDLE  msg != DLG_INIT) {
sync_need_panels_redraw = 0;
set_idle_proc (h, 1);
}

   This could be pretty nasty with the current processing code for
   DLG_INIT in `midnight_callback ()'.

   You can change the default value by editing the value of `auto_menu' in
   ~/.mc/ini to 1.

2) Your code will call multiple times `sync_setup_panels()' from within
   the DLG_IDLE handler in `midnight_callback()'. On systems which do not
   support dnotify it could be useful to have a flag which will indicate
   that dnotify is not present so `sync_setup_panels()' should do nothing
   after the first unsuccesful call i.e. if the following call

 fcntl(sync_fd[panel_id], F_NOTIFY, DN_MODIFY
| DN_CREATE
| DN_DELETE
| DN_RENAME
| DN_MULTISHOT
);

   fails and `errno' is set to EINVAL you can set a flag and do not
   call `sync_setup_panels ()' anymore for obvious reasons. Same for
   `loose_sync ()'.

3) You are doing a quite obscure error handling through the `sync_err'
   pointer. Also why do you set the different bits in in `sync_err' if you
   never check them ?

4) There seems to be no cleanup function which closes the open
   directory filedescriptors. Well you close them before opening them
   in `_setup_sync'. But a general cleanup should be available
   to be called on MC's termination or something like that.

5) Please, declare everything that you are going to use outside of the
   sync4 module in sync4.h . Also your changes to main.h should be
   actually put in sync4.h. Every function or variable that is used in
   sync4.c should be made static.

6) Avoid writing code like this

 if (!(sync_errs[0]||sync_errs[1])) 
add_hook(idle_hook,update_hook,sync_update_flag); /* hook for synchronization 
*/

   It should be written like this


 /* hook for synchronization */
 if (!(sync_errs[0]||sync_errs[1]))
 add_hook(idle_hook,update_hook,sync_update_flag);

   You should try to arrange your code as the rest of MC's code.

6) You should include config.h at the beginning of sync4.c like this:

 #ifdef HAVE_CONFIG_H
 #include config.h
 #endif

I think this is enough for now.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [patch] Synchronization of the panels

2005-04-08 Thread Pavel Tsekov


On Fri, 8 Apr 2005, Pavel Tsekov wrote:

  Suggestions are welcome.

 Ok - several points:

8) Another thing that might be of interest. You can check if the
   directory you are monitoring resides on a vfs and if this is the
   case you have to disable monitoring for that directory. You can use the
   following method for example:


   int flags = vfs_file_class_flags (path);
   if (flags  VFSF_LOCAL) {
 ...
   } else {
 disable dnotify
   }


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Fw: [patch] Synchronization of the panels (fwd)

2005-03-17 Thread Siver Andrey
Hello Pavel,

- Original Message - 
From: Pavel Tsekov [EMAIL PROTECTED]
To: Siver Andrey [EMAIL PROTECTED]
Cc: mc-devel@gnome.org
Sent: Wednesday, March 09, 2005 6:48 PM
Subject: Re: Fw: [patch] Synchronization of the panels (fwd)


 Hello Andrey,

 On Wed, 16 Mar 2005, Siver Andrey wrote:

   - Original Message -
   From: Miguel de Icaza [EMAIL PROTECTED]
   To: Pavel Tsekov [EMAIL PROTECTED]
   Cc: MC dev mc-devel@gnome.org
   Sent: Saturday, February 26, 2005 7:40 PM
   Subject: Re: [patch] Synchronization of the panels (fwd)
  
Hello,
   
Configure patches, fall back patches are missing as well.
  
   I would like to ask somebody to update configure scripts (WITH_SYNC
need
  to
   be defined if kernel version = 2.4. If it's not defined - the patch
gives
   nothing new, so I do not understand what do you mean by fall back
   patches).
  
   Is anybody ready to do it?
 It must be you . You can get some help/advice in the process of reviewing
 your patch - but do not expect others to do your job.

Do you know how to detect kernel version = 2.4 at configure time and how to
add corresponding parameter to gcc?


Andrey

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: Fw: [patch] Synchronization of the panels (fwd)

2005-03-16 Thread Pavel Tsekov
Hello Andrey,

On Wed, 16 Mar 2005, Siver Andrey wrote:

  - Original Message -
  From: Miguel de Icaza [EMAIL PROTECTED]
  To: Pavel Tsekov [EMAIL PROTECTED]
  Cc: MC dev mc-devel@gnome.org
  Sent: Saturday, February 26, 2005 7:40 PM
  Subject: Re: [patch] Synchronization of the panels (fwd)
 
 
   Hello,
  
   The patch still needs a lot of work, for example, why do we have an
   include file at all with the code?  (The core of the code lives in
   sync.inc).
 
  It's not a problem if it's the last problem (it's easy to embed sync.inc
  straight into main.c).

Well, it is even easier to create a new set of files (.h and .c) devoted
to this new feature and then patch the Makefile.am files to include the
new module in the build.

   Configure patches, fall back patches are missing as well.
 
  I would like to ask somebody to update configure scripts (WITH_SYNC need
 to
  be defined if kernel version = 2.4. If it's not defined - the patch gives
  nothing new, so I do not understand what do you mean by fall back
  patches).
 
  Is anybody ready to do it?

It must be you . You can get some help/advice in the process of reviewing
your patch - but do not expect others to do your job.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [patch] Synchronization of the panels (fwd)

2005-02-26 Thread Miguel de Icaza
Hello,

 This is an updated version of the dnotify patch from Andrey Siver.

The patch still needs a lot of work, for example, why do we have an
include file at all with the code?  (The core of the code lives in
sync.inc).

Configure patches, fall back patches are missing as well.

Miguel.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [patch] Synchronization of the panels

2005-02-26 Thread Miguel de Icaza
Hello,

  Please consider my patch to synchronize the panels with hard drives
  state.
   
 note that dnotify prevents a watched directory from being unmounted (one
 of the reasons why it is being replaced). that means one has to leave
 the dir in question in both panels. no problem as such, but it might
 lead to surprises ...

It could be argued that if mc is watching a directory, mc is in that
directory so unmounting should not be an issue at this point, but
adopting something like inotify in the long run seems like a better
option.

The other problem with the patch is that it lacks the configure magic to
work on non-dnotify systems, and also lacks support for not aborting if
the code is not available in the current kernel.

The patch is a nice one, but it needs to be productized.


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [patch] Synchronization of the panels

2005-02-25 Thread Pavel Tsekov
Hello Andrey,

On Fri, 25 Feb 2005, Siver Andrey wrote:

 Dear maintainer,

I am not in charge of maintaining MC. I am just one of the MC
contributors :)

 I agree with you.
 I update the patch in following ways:
 1) Try to format properly;
 2) Add feature conditions (with WITH_SYNC macro-parameter). So, now it's
 possible to exclude the code in case of kernel version  2.4.X at
 compilation time. I would like to ask somebody to update configure scripts
 processing this;
 3) Add error processing (with sync_err global variable);
 4) Some other changes.

Please, post to the mailing list and not to mail personal e-mail. I read
the list on regular basis and so do others. I've forwarded your mail to
the MC developers mailing list.

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[patch] Synchronization of the panels

2005-02-21 Thread Siver Andrey



Hi,

Please consider my patch to synchronize the panels 
with hard drives state.


Andrey


main.c.diff
Description: Binary data


sync.inc
Description: Binary data
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel