[Pm-utils] [Patch] TuxOnIce pm/functions patch draft.
Nigel Cunningham
nigel at nigel.suspend2.net
Sun Jan 27 19:27:14 PST 2008
Hi.
Michael Biebl wrote:
> 2008/1/28, Victor Lowther <victor.lowther at gmail.com>:
>> On Jan 27, 2008 8:34 PM, Nigel Cunningham <nigel at nigel.suspend2.net> wrote:
>>
>> do_hibernate()
>> {
>> if [ -d /sys/power/tuxonice ]; then
>> do_tuxonice_hibernate
>> else
>> echo -n "${HIBERNATE_MODE}" > /sys/power/disk
>> echo -n "disk" > /sys/power/state
>> fi
>> }
>>
>
> I'd say, we should add additional functions
> hibernate_method() and suspend_method() and two config variables
> HIBERNATE_METHOD and SUSPEND_METHOD.
>
> The default for the two variables should be "autodetect".
> hibernate_method() should return the value of HIBERNATE_METHOD unless
> its autodetect.
> In that case it should check for tuxonice support (and return
> "tuxonice" if found), then uswsusp (return "userspace" if found) and
> finally check for kernel (return "kernel" if found);
> The same for suspend_method().
> The variables HIBERNATE_METHOD, SUSPEND_METHOD could be overwritten by
> the user/distributor to enforce a given method.
>
>
> do_hibernate() would then be:
>
> do_hibernate()
> {
> case $(hibernate_method)
> tuxonice)
> do_tuxonice_hibernate
> ;;
> userspace)
> do_userspace_hibernate
> ;;
> kernel)
> do_kernel_hibernate
> ;;
> esac
> }
>
> And the different implementations would follow.
>
> What do you think about that?
That sounds good to me. I was going to do something like that as a
separate patch. If you want to come up with it first, feel free!
Nigel
More information about the Pm-utils
mailing list