]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/locking/dlm/plock.c
[PATCH] mark struct file_operations const 6
[linux-2.6-omap-h63xx.git] / fs / gfs2 / locking / dlm / plock.c
index f7ac5821def9d5eed4f664a40a8c6375eee79381..1dd4215b83d02133592033949bced668548102cc 100644 (file)
@@ -3,11 +3,12 @@
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU General Public License v.2.
+ * of the GNU General Public License version 2.
  */
 
 #include <linux/miscdevice.h>
 #include <linux/lock_dlm_plock.h>
+#include <linux/poll.h>
 
 #include "lock_dlm.h"
 
@@ -58,10 +59,10 @@ static void send_op(struct plock_op *op)
        wake_up(&send_wq);
 }
 
-int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
+int gdlm_plock(void *lockspace, struct lm_lockname *name,
               struct file *file, int cmd, struct file_lock *fl)
 {
-       struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
+       struct gdlm_ls *ls = lockspace;
        struct plock_op *op;
        int rv;
 
@@ -70,13 +71,14 @@ int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
                return -ENOMEM;
 
        op->info.optype         = GDLM_PLOCK_OP_LOCK;
-       op->info.pid            = (uint32_t) fl->fl_owner;
+       op->info.pid            = fl->fl_pid;
        op->info.ex             = (fl->fl_type == F_WRLCK);
        op->info.wait           = IS_SETLKW(cmd);
        op->info.fsid           = ls->id;
        op->info.number         = name->ln_number;
        op->info.start          = fl->fl_start;
        op->info.end            = fl->fl_end;
+       op->info.owner          = (__u64)(long) fl->fl_owner;
 
        send_op(op);
        wait_event(recv_wq, (op->done != 0));
@@ -93,17 +95,18 @@ int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name,
        if (!rv) {
                if (posix_lock_file_wait(file, fl) < 0)
                        log_error("gdlm_plock: vfs lock error %x,%llx",
-                                 name->ln_type, name->ln_number);
+                                 name->ln_type,
+                                 (unsigned long long)name->ln_number);
        }
 
        kfree(op);
        return rv;
 }
 
-int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
+int gdlm_punlock(void *lockspace, struct lm_lockname *name,
                 struct file *file, struct file_lock *fl)
 {
-       struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
+       struct gdlm_ls *ls = lockspace;
        struct plock_op *op;
        int rv;
 
@@ -113,14 +116,15 @@ int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
 
        if (posix_lock_file_wait(file, fl) < 0)
                log_error("gdlm_punlock: vfs unlock error %x,%llx",
-                         name->ln_type, name->ln_number);
+                         name->ln_type, (unsigned long long)name->ln_number);
 
        op->info.optype         = GDLM_PLOCK_OP_UNLOCK;
-       op->info.pid            = (uint32_t) fl->fl_owner;
+       op->info.pid            = fl->fl_pid;
        op->info.fsid           = ls->id;
        op->info.number         = name->ln_number;
        op->info.start          = fl->fl_start;
        op->info.end            = fl->fl_end;
+       op->info.owner          = (__u64)(long) fl->fl_owner;
 
        send_op(op);
        wait_event(recv_wq, (op->done != 0));
@@ -138,10 +142,10 @@ int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name,
        return rv;
 }
 
-int gdlm_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
+int gdlm_plock_get(void *lockspace, struct lm_lockname *name,
                   struct file *file, struct file_lock *fl)
 {
-       struct gdlm_ls *ls = (struct gdlm_ls *) lockspace;
+       struct gdlm_ls *ls = lockspace;
        struct plock_op *op;
        int rv;
 
@@ -150,7 +154,7 @@ int gdlm_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name,
                return -ENOMEM;
 
        op->info.optype         = GDLM_PLOCK_OP_GET;
-       op->info.pid            = (uint32_t) fl->fl_owner;
+       op->info.pid            = fl->fl_pid;
        op->info.ex             = (fl->fl_type == F_WRLCK);
        op->info.fsid           = ls->id;
        op->info.number         = name->ln_number;
@@ -228,8 +232,8 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
 
        spin_lock(&ops_lock);
        list_for_each_entry(op, &recv_list, list) {
-               if (op->info.fsid == info.fsid &&
-                   op->info.number == info.number) {
+               if (op->info.fsid == info.fsid && op->info.number == info.number &&
+                   op->info.owner == info.owner) {
                        list_del_init(&op->list);
                        found = 1;
                        op->done = 1;
@@ -243,7 +247,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count,
                wake_up(&recv_wq);
        else
                printk(KERN_INFO "gdlm dev_write no op %x %llx\n", info.fsid,
-                       info.number);
+                       (unsigned long long)info.number);
        return count;
 }
 
@@ -260,7 +264,7 @@ static unsigned int dev_poll(struct file *file, poll_table *wait)
        return 0;
 }
 
-static struct file_operations dev_fops = {
+static const struct file_operations dev_fops = {
        .read    = dev_read,
        .write   = dev_write,
        .poll    = dev_poll,