Subject: Re: bin/35547: add timeout to cgdconfig
To: None <gnats-bugs@NetBSD.org>
From: Anne Bennett <anne@encs.concordia.ca>
List: netbsd-bugs
Date: 02/04/2007 16:35:50
Lubomir Sedlacik <salo@Xtrmntr.org> comments on my request for improvement:

>  what if you have e.g., two cgd(4) volumes, where one is swap and it can
>  be configured just fine without any user interaction?
>  
>  i think the rc.d script is the wrong place to do this kind of things.
>  ideally, there would be a per-volume option which could be added to
>  cgd.conf.

My first though was that this would be even better than my proposal of a
"-t seconds" option to cgdconfig, but then two tihngs occurred to me:

  - no point having a separate timeout for all the "user interaction
    required" cgd volumes, since either the user is sitting there or
    she isn't, so there's no point timing out more than once, and

  - cgdconfig know when user interaction is needed, since it prompts
    for it, so the "-t seconds" option should affect only volumes
    that require user interaction.

My thoughts, based on your comment:

  - globals: timeout_requested (0 by default, else -t argument)
             timeout_has_been_done (starts false)
             a_user_is_present (starts false)

  - for each cgd volume:
      if user interaction needed for this volume
         if ! a_user_is_present and ! timeout_has_been_done and timeout_requested
             start timeout:
               if user indicates they are present:
                 set a_user_is_present
                 set timeout_has_been_done
               else
                 set timeout_has_been_done

         if ! timeout_requested or a_user_is_present
           proceed with requesting password
           configure volume
         else
           skip this one
      else (no user interaction needed for this volume)
        configure volume


Anne.
-- 
Ms. Anne Bennett, Senior Sysadmin, ENCS, Concordia University, Montreal H3G 1M8
anne@encs.concordia.ca                                    +1 514 848-2424 x2285