mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Stoyan Gaydarov" <stoyboyker@gmail.com>
To: rjw@sisk.pl, pavel@suse.cz
Cc: linux-kernel@vger.kernel.org, linux-pm@lists.linux-foundation.org
Subject: [PATCH] ioctl conversion
Date: Thu, 10 Jul 2008 19:28:16 -0500	[thread overview]
Message-ID: <6d291e080807101728j62be7c93qba11aa214a8dfe1@mail.gmail.com> (raw)

This changes the ioctl usage of kernel/power/user.c to use the unlocked_ioctl

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>

diff -uprN linux-2.6.26-rc9/kernel/power/user.c devel/kernel/power/user.c
--- linux-2.6.26-rc9/kernel/power/user.c        2008-07-05
17:53:22.000000000 -0500
+++ devel/kernel/power/user.c   2008-07-10 19:26:42.000000000 -0500
@@ -18,6 +18,7 @@
 #include <linux/mm.h>
 #include <linux/swap.h>
 #include <linux/swapops.h>
+#include <linux/smp_lock.h>
 #include <linux/pm.h>
 #include <linux/fs.h>
 #include <linux/console.h>
@@ -164,20 +165,28 @@ static ssize_t snapshot_write(struct fil
        return res;
 }

-static int snapshot_ioctl(struct inode *inode, struct file *filp,
-                          unsigned int cmd, unsigned long arg)
+static long snapshot_ioctl(struct file *filp, unsigned int cmd,
+                          unsigned long arg)
 {
        int error = 0;
        struct snapshot_data *data;
        loff_t size;
        sector_t offset;

-       if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC)
+       lock_kernel();
+
+       if (_IOC_TYPE(cmd) != SNAPSHOT_IOC_MAGIC) {
+               unlock_kernel();
                return -ENOTTY;
-       if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR)
+       }
+       if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR) {
+               unlock_kernel();
                return -ENOTTY;
-       if (!capable(CAP_SYS_ADMIN))
+       }
+       if (!capable(CAP_SYS_ADMIN)) {
+               unlock_kernel();
                return -EPERM;
+       }

        data = filp->private_data;

@@ -390,6 +399,7 @@ static int snapshot_ioctl(struct inode *

        }

+       unlock_kernel();
        return error;
 }

@@ -399,7 +409,7 @@ static const struct file_operations snap
        .read = snapshot_read,
        .write = snapshot_write,
        .llseek = no_llseek,
-       .ioctl = snapshot_ioctl,
+       .unlocked_ioctl = snapshot_ioctl,
 };

 static struct miscdevice snapshot_device = {

             reply	other threads:[~2008-07-11  0:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-11  0:28 Stoyan Gaydarov [this message]
2008-07-11  8:08 ` Arnd Bergmann
2008-07-11  8:21   ` Stoyan Gaydarov
2008-07-11  9:22     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d291e080807101728j62be7c93qba11aa214a8dfe1@mail.gmail.com \
    --to=stoyboyker@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®