lkml.org 
[lkml]   [2014]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v2 1/2] hibernate: create "nohibernate" boot parameter
    On Thu 2014-06-12 14:00:32, Kees Cook wrote:
    > To support using kernel features that are not compatible with hibernation,
    > this creates the "nohibernate" kernel boot parameter to disable both
    > hibernation and resume. This allows hibernation support to be a boot-time
    > choice instead of only a compile-time choice.
    >
    > Signed-off-by: Kees Cook <keescook@chromium.org>


    > @@ -639,6 +645,11 @@ int hibernate(void)
    > {
    > int error;
    >
    > + if (!hibernation_available()) {
    > + pr_debug("PM: Hibernation not available.\n");
    > + return -EINVAL;
    > + }
    > +
    > lock_system_sleep();
    > /* The snapshot device should not be opened while we're running */
    > if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
    > @@ -931,6 +945,9 @@ static ssize_t disk_store(struct kobject *kobj, struct kobj_attribute *attr,
    > char *p;
    > int mode = HIBERNATION_INVALID;
    >
    > + if (!hibernation_available())
    > + return -EINVAL;
    > +
    > p = memchr(buf, '\n', n);
    > len = p ? p - buf : n;
    >
    > diff --git a/kernel/power/user.c b/kernel/power/user.c
    > index 98d357584cd6..000b94419182 100644
    > --- a/kernel/power/user.c
    > +++ b/kernel/power/user.c
    > @@ -49,6 +49,9 @@ static int snapshot_open(struct inode *inode, struct file *filp)
    > struct snapshot_data *data;
    > int error;
    >
    > + if (!hibernation_available())
    > + return -EINVAL;
    > +
    > lock_system_sleep();
    >
    > if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {

    Is EINVAL right error code for "root disabled that option"?

    Otherwise it looks ok, you can add my ack with that fixed.
    Pavel
    --
    (english) http://www.livejournal.com/~pavelmachek
    (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


    \
     
     \ /
      Last update: 2014-06-13 14:01    [W:3.216 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site