rdmenezes / remote-testbed

Automatically exported from code.google.com/p/remote-testbed
0 stars 1 forks source link

Use inotify in MCH to watch the device hierarchy #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The current method of notifying the MCH of new mote devices is not optimal
for several reasons:

 - For motes with two TTYs, UDEV will generate an event for each TTY
meaning that the MCH will be notified multiple times for the same mote device.

 - MCH needs to revalidate all mote devices each time one mote device is
added or removed.

 - It creates an unnecessary dependency between the UDEV scripts and the
MCH in terms of the event pipe file and its location.

By making the MCH use inotify to keep track of changes in the /dev/remote
directory, MCH will become less dependent on UDEV scripts, and the MCH will
be able to know exactly which mote device was added or removed and act
accordingly.

It will make it possible to remove the plugpiper program and the use of the
event pipe which should end up requiring less resources.

Original issue reported on code.google.com by jonas.fonseca on 12 Nov 2007 at 9:02

GoogleCodeExporter commented 9 years ago

Original comment by jonas.fonseca on 12 Nov 2007 at 10:39

GoogleCodeExporter commented 9 years ago
A preliminary patch to show (mainly) which non-code files needs to be changed. 
It
doesn't do any advanced filtering on events generated from watched directories, 
which
seems to really be the key to get good performance with inotify. Since inotify 
only
reports file events 1-level deep, MCH will have to add watches for all 
directories
created in /dev/remote. Additionally, adding a watch for one key file such as 
the TTY
symlink or the path file will allow very explicit filtering. This will require 
that
watch descriptors returned by inotify_add_watch() are stored in a hash to keep 
track
of which watch descriptor is a path etc.

Original comment by jonas.fonseca on 14 Nov 2007 at 8:09

Attachments:

GoogleCodeExporter commented 9 years ago
Another benefit from this is that the MCH will be able to run with less 
privileges
when the event pipe is not needed, so that only the UDEV scripts requires
administrator permissions.

Original comment by jonas.fonseca on 14 Nov 2007 at 8:21

GoogleCodeExporter commented 9 years ago
Link to good article on inotify: http://www.linuxjournal.com/article/8478

Original comment by jonas.fonseca on 7 Dec 2007 at 11:17

GoogleCodeExporter commented 9 years ago
If this is added after the device hierarchy has been moved to /var/run/remote 
it will
greatly simplify the number of inotify watches that will be needed. We will be 
able
to only add watches directories:

 - /dev/remote to monitor when motes are added
 - /dev/remote/MOTEMAC to monitor when the mote TTYs are removed

Original comment by jonas.fonseca on 22 Mar 2008 at 12:57