locking changes + guidelines for SystemPowerManagement

David Zeuthen david at fubar.dk
Sun Apr 1 00:24:44 PDT 2007


Hey,

So, among other things, I've just pushed a number of changes to the new
locking API; the executive summary is as follows

1. If multiple callers hold a lock, they can now individually call
   into the device. Previously, they were all locked out.

2. Added signals on .Device and .Manager that fires when resp.
   per-device and global locks are acquired/released

3. Added a new method Device.IsLockedByOthers() to figure out if
   other callers than yourself is holding a lock

4. If you hold a lock, you can now lose it. This only applies in
   reality when HAL is built with --enable-console-kit. The current
   hardcoded policy (that will be replaced by PolicyKit soon) is
   that apart from the root computer device object, you lose a lock
   if your session becomes inactive. Of course, uid 0 isn't affected
   by this; he can keep the locks around

5. Added some libhal convenience API for both 2. and 3.

6. Made hald-addon-storage stop polling if the drive is locked via HAL

7. Added --exit-with-lock and --exit-with-dev options to the hal-lock(1)
   program for non-HAL (legacy! hah!) apps

The main reason for these changes has to do with the fact that it's
needed by the guidelines for how I think power management daemons that
use the HAL mechanism (such as gnome-power-manager and kpowersave)
should interact with each other to work well in both fast-user-switching
and multi-seat configurations. And also how they interact when
system-level software such as yum/rpm wants to inhibit certain actions
when doing big and dangerous RPM transactions. 

Anyway, I've uploaded these guidelines here

 http://people.freedesktop.org/~david/hal-spec/hal-spec.html#locking-guidelines

and I'd like feedback (preferably in diff -u form!). I don't think this
is something that needs to block the 0.5.9 release; in the worst case we
can change the semantics of the locking API for 0.5.10 - we're still at
pre 1.0 and this is all new API. Anyway, I *think* these guidelines
might work. Please comment. Thanks!

      David




More information about the hal mailing list