Use menuconfig objects: libata
[powerpc.git] / fs / gfs2 / locking.c
index 6a78aac..663fee7 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
- * Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
  *
  * 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/module.h>
 #include <linux/kmod.h>
 #include <linux/fs.h>
 #include <linux/delay.h>
-
-#include "lm_interface.h"
+#include <linux/lm_interface.h>
 
 struct lmh_wrapper {
        struct list_head lw_list;
-       struct lm_lockops *lw_ops;
+       const struct lm_lockops *lw_ops;
 };
 
 /* List of registered low-level locking protocols.  A file system selects one
    of them by name at mount time, e.g. lock_nolock, lock_dlm. */
 
-static struct list_head lmh_list;
-static struct mutex lmh_lock;
+static LIST_HEAD(lmh_list);
+static DEFINE_MUTEX(lmh_lock);
 
 /**
- * gfs_register_lockproto - Register a low-level locking protocol
+ * gfs2_register_lockproto - Register a low-level locking protocol
  * @proto: the protocol definition
  *
  * Returns: 0 on success, -EXXX on failure
  */
 
-int gfs_register_lockproto(struct lm_lockops *proto)
+int gfs2_register_lockproto(const struct lm_lockops *proto)
 {
        struct lmh_wrapper *lw;
 
@@ -67,12 +66,12 @@ int gfs_register_lockproto(struct lm_lockops *proto)
 }
 
 /**
- * gfs_unregister_lockproto - Unregister a low-level locking protocol
+ * gfs2_unregister_lockproto - Unregister a low-level locking protocol
  * @proto: the protocol definition
  *
  */
 
-void gfs_unregister_lockproto(struct lm_lockops *proto)
+void gfs2_unregister_lockproto(const struct lm_lockops *proto)
 {
        struct lmh_wrapper *lw;
 
@@ -99,7 +98,7 @@ void gfs_unregister_lockproto(struct lm_lockops *proto)
  * @table_name - the name of the lock space
  * @host_data - data specific to this host
  * @cb - the callback to the code using the lock module
- * @fsdata - data to pass back with the callback
+ * @sdp - The GFS2 superblock
  * @min_lvb_size - the mininum LVB size that the caller can deal with
  * @flags - LM_MFLAG_*
  * @lockstruct - a structure returned describing the mount
@@ -108,7 +107,7 @@ void gfs_unregister_lockproto(struct lm_lockops *proto)
  */
 
 int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
-                        lm_callback_t cb, lm_fsdata_t *fsdata,
+                        lm_callback_t cb, void *cb_data,
                         unsigned int min_lvb_size, int flags,
                         struct lm_lockstruct *lockstruct,
                         struct kobject *fskobj)
@@ -117,7 +116,7 @@ int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
        int try = 0;
        int error, found;
 
- retry:
+retry:
        mutex_lock(&lmh_lock);
 
        found = 0;
@@ -147,11 +146,11 @@ int gfs2_mount_lockproto(char *proto_name, char *table_name, char *host_data,
                goto retry;
        }
 
-       error = lw->lw_ops->lm_mount(table_name, host_data, cb, fsdata,
+       error = lw->lw_ops->lm_mount(table_name, host_data, cb, cb_data,
                                     min_lvb_size, flags, lockstruct, fskobj);
        if (error)
                module_put(lw->lw_ops->lm_owner);
- out:
+out:
        mutex_unlock(&lmh_lock);
        return error;
 }
@@ -180,12 +179,6 @@ void gfs2_withdraw_lockproto(struct lm_lockstruct *lockstruct)
        mutex_unlock(&lmh_lock);
 }
 
-void __init gfs2_init_lmh(void)
-{
-       mutex_init(&lmh_lock);
-       INIT_LIST_HEAD(&lmh_list);
-}
-
-EXPORT_SYMBOL_GPL(gfs_register_lockproto);
-EXPORT_SYMBOL_GPL(gfs_unregister_lockproto);
+EXPORT_SYMBOL_GPL(gfs2_register_lockproto);
+EXPORT_SYMBOL_GPL(gfs2_unregister_lockproto);