diff options
author | Benny Halevy <bhalevy@panasas.com> | 2011-05-22 12:49:06 -0400 |
---|---|---|
committer | Boaz Harrosh <bharrosh@panasas.com> | 2011-05-29 13:52:35 -0400 |
commit | c93407d03c3ccf60b33a309e5fcd41cd98969901 (patch) | |
tree | 9ef9cfb8a2c8dd7ae05960469bfef0d396363dc4 /fs/nfs/objlayout | |
parent | ae50c0b5c6f6fa340f1fe2d244b358145f7e5a15 (diff) |
pnfs-obj: objlayoutdriver module skeleton
* Define the PNFS_OBJLAYOUT Kconfig option in the nfs
master Kconfig file.
* Add the objlayout driver to the Kernel's Kbuild system.
* Add the fs/nfs/objlayout/Kbuild file for building the
objlayoutdriver.ko driver
* Define fs/nfs/objlayout/objio_osd.c, register the driver on module
initialization and unregister on exit.
[pnfs-obj: remove of CONFIG_PNFS fallout]
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
[added "unsure" clause]
[depend on NFS_V4_1]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs/objlayout')
-rw-r--r-- | fs/nfs/objlayout/Kbuild | 5 | ||||
-rw-r--r-- | fs/nfs/objlayout/objio_osd.c | 76 |
2 files changed, 81 insertions, 0 deletions
diff --git a/fs/nfs/objlayout/Kbuild b/fs/nfs/objlayout/Kbuild new file mode 100644 index 000000000000..2e5b9a44773c --- /dev/null +++ b/fs/nfs/objlayout/Kbuild | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the pNFS Objects Layout Driver kernel module | ||
3 | # | ||
4 | objlayoutdriver-y := objio_osd.o | ||
5 | obj-$(CONFIG_PNFS_OBJLAYOUT) += objlayoutdriver.o | ||
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c new file mode 100644 index 000000000000..379595f2d1cc --- /dev/null +++ b/fs/nfs/objlayout/objio_osd.c | |||
@@ -0,0 +1,76 @@ | |||
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); | ||