[Pm-utils] [PATCH 3/6] Split out hooks that should be aux hooks.

Victor Lowther victor.lowther at gmail.com
Fri May 16 16:49:35 PDT 2008


On Fri, 2008-05-16 at 10:53 +0200, Stefan Seyfried wrote:
> Victor Lowther wrote:
> > This includes bluetooth handling, the ntpd part of clock handling,
> > and network-manager handling.  More to come later.
> > 
> > Also updates the documentation.
> > ---
> >  pm/HOWTO.hooks                                   |   21 +++++++--
> >  pm/sleep.d/90clock                               |   54 +++++----------------
> >  pm/sleep.d/{49bluetooth => bluetooth}            |    0 
> 
> >  pm/sleep.d/{10NetworkManager => network-manager} |    0 
> >  pm/sleep.d/ntpd                                  |   31 ++++++++++++
> 
> I do not think that the network-manager and the ntpd hooks dont have any
> ordering requirements.

The only reason they have explicit ordering right now on resume is
because I have not been able to figure out how to ask NetworkManager if
an interface is up using nothing but standard POSIX commands.  The
current "wait 20 seconds and start the service" is a hack -- ntpd should
be smart enough to just wait until an interface comes up without any
intervention on our behalf.

> > diff --git a/pm/HOWTO.hooks b/pm/HOWTO.hooks
> > index 7beb1f2..ddf4044 100644
> > --- a/pm/HOWTO.hooks
> > +++ b/pm/HOWTO.hooks
> > @@ -28,13 +28,26 @@ false -- The hook MUST perform whatever action is appropriate when the system
> >  
> >  NAMING SCHEME
> >  
> > -All hooks are run in lexical sort order according to the C locale.
> > +Hooks are always run in one of two phases, either the core phase or
> > +the aux phase.  The pm-utils infrastructure classifies hooks into
> > +these two phases based on how the hooks are named.
> > +
> > +A hook will be classified as a core hook if the first two characters
> > +of its base filename are any of the digits 0 through 9.  Any other
> > +hook will be classified as an aux hook.
> > +
> > +When running hooks forwards, all aux hooks will run first in no
> > +specified order, and when they are all finished the core hooks will
> > +run in C locale lexical sort order.
> > +
> > +When running hooks backwards, all core hooks are run in reverse C
> > +lexical sort order, then all aux hooks will run in no specified order.
> 
> Just one question: Do you think somebody who does not yet have had anything to
> do with this stuff and even does not want to have anything to do with it, but
> needs to write a hook for his software package, still knows when and if his
> hook will run and what the outcome will be?

I think the ordering rules in the bit of the patch you quoted were
clear.

More generally, if you are asking me what to do about a developer who
(for whatever reason) needs to have something happen across
suspend/resume, wants that something to happen as a pm-utils hook, but
refuses to read the documentation that describes how to write a hook and
what to expect when it is run, then I have no answer for that, but
placing the fault with me or with pm-utils is a bit of a stretch in that
scenario.

> Remember, one of the design ideas of pm-utils, back when Peter Jones was doing
> it was to keep it simple and easy, even easy to understand, both for users and
> for people wanting to write a hook or a "plugin" for it.

And how has that changed, except that the code is no longer mostly
Peter's?  

> I really think this is all going to be totally overengineered (not only this
> change but all of the big overhaul that has taken place lately) and it is
> defeating the original purpose.
>
> This is one reason why i'm sticking to the old codebase: users and developers
> just understand what it is doing and they like that. It is easy to explain and
> bugs are easy to fix.

Fair enough.  Our opinions differ in this regard, and I will leave it at
that for now.

> Have fun,
> 
> 	Stefan
-- 
Victor Lowther
Ubuntu Certified Professional



More information about the Pm-utils mailing list