pnfs-obj: objlayoutdriver module skeleton
[pandora-kernel.git] / fs / nfs / objlayout / objio_osd.c
1 /*
2  *  pNFS Objects layout implementation over open-osd initiator library
3  *
4  *  Copyright (C) 2009 Panasas Inc. [year of first publication]
5  *  All rights reserved.
6  *
7  *  Benny Halevy <bhalevy@panasas.com>
8  *  Boaz Harrosh <bharrosh@panasas.com>
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2
12  *  See the file COPYING included with this distribution for more details.
13  *
14  *  Redistribution and use in source and binary forms, with or without
15  *  modification, are permitted provided that the following conditions
16  *  are met:
17  *
18  *  1. Redistributions of source code must retain the above copyright
19  *     notice, this list of conditions and the following disclaimer.
20  *  2. Redistributions in binary form must reproduce the above copyright
21  *     notice, this list of conditions and the following disclaimer in the
22  *     documentation and/or other materials provided with the distribution.
23  *  3. Neither the name of the Panasas company nor the names of its
24  *     contributors may be used to endorse or promote products derived
25  *     from this software without specific prior written permission.
26  *
27  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
28  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
34  *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39
40 #include <linux/module.h>
41 #include "../pnfs.h"
42
43 static struct pnfs_layoutdriver_type objlayout_type = {
44         .id = LAYOUT_OSD2_OBJECTS,
45         .name = "LAYOUT_OSD2_OBJECTS",
46 };
47
48 MODULE_DESCRIPTION("pNFS Layout Driver for OSD2 objects");
49 MODULE_AUTHOR("Benny Halevy <bhalevy@panasas.com>");
50 MODULE_LICENSE("GPL");
51
52 static int __init
53 objlayout_init(void)
54 {
55         int ret = pnfs_register_layoutdriver(&objlayout_type);
56
57         if (ret)
58                 printk(KERN_INFO
59                         "%s: Registering OSD pNFS Layout Driver failed: error=%d\n",
60                         __func__, ret);
61         else
62                 printk(KERN_INFO "%s: Registered OSD pNFS Layout Driver\n",
63                         __func__);
64         return ret;
65 }
66
67 static void __exit
68 objlayout_exit(void)
69 {
70         pnfs_unregister_layoutdriver(&objlayout_type);
71         printk(KERN_INFO "%s: Unregistered OSD pNFS Layout Driver\n",
72                __func__);
73 }
74
75 module_init(objlayout_init);
76 module_exit(objlayout_exit);