Note that there are some explanatory texts on larger screens.

plurals
  1. PODetecting foreign IN_MOVED_FROM renames with inotify
    primarykey
    data
    text
    <p>Assume a C program which mirrors the changes in a watched directory to a mirror directory. You recursively watch all subdirectories and use a structure indexed on <code>watch descriptors</code> containing the <code>pathnames</code> of the watched directories to be able to reconstruct the full pathname of the file in case of an event. This is all you need to process all events but <code>IN_MOVED_FROM</code> and <code>IN_MOVED_TO</code>. In the case of these two, you, in addition to the aforementioned, seem to also need the following:</p> <ul> <li>A structure indexed on <code>cookies</code> allowing you to store and retrieve the <code>watch descriptor</code> and the <code>filename</code> of a particular <code>IN_MOVED_FROM</code> event once a matching <code>IN_MOVED_TO</code> event appears.</li> <li>A <code>timestamp</code>-ordered queue (redundant) containing cookies which have not yet been paired, so that they can be reinterpreted as <code>IN_DELETE</code> events and removed from both of the structures once an arbitrary period of time has passed.</li> <li>A <code>pathname/filename</code> -> <code>watch descriptor</code> relation (redundant), which allows you to effectively find out the <code>watch descriptor</code> of a timeouted <code>cookie</code> in case the (re)moved filesystem object was a directory, which you now need to unwatch.</li> </ul> <p>Quite some overhead for supporting rename operations. Is there really no other way to detect a foreign rename other than waiting for an unpaired cookie to time out? Given the fact that there <a href="http://www.spinics.net/lists/linux-fsdevel/msg46040.html" rel="nofollow">appears to be a way of telling between a local and foreign rename</a> in <a href="http://lxr.free-electrons.com/source/include/linux/fsnotify.h" rel="nofollow">fsnotify</a>, this seems as a rather odd design choice.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload