| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 1 | /* | 
 | 2 |  *	Configuration OSM | 
 | 3 |  * | 
 | 4 |  *	Copyright (C) 2005	Markus Lidel <Markus.Lidel@shadowconnect.com> | 
 | 5 |  * | 
 | 6 |  *	This program is free software; you can redistribute it and/or modify it | 
 | 7 |  *	under the terms of the GNU General Public License as published by the | 
 | 8 |  *	Free Software Foundation; either version 2 of the License, or (at your | 
 | 9 |  *	option) any later version. | 
 | 10 |  * | 
 | 11 |  *	Fixes/additions: | 
 | 12 |  *		Markus Lidel <Markus.Lidel@shadowconnect.com> | 
 | 13 |  *			initial version. | 
 | 14 |  */ | 
 | 15 |  | 
 | 16 | #include <linux/module.h> | 
 | 17 | #include <linux/i2o.h> | 
| Andrew Morton | ca3f5a9 | 2005-07-07 17:56:02 -0700 | [diff] [blame] | 18 | #include <linux/dcache.h> | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 19 | #include <linux/namei.h> | 
| Andrew Morton | ca3f5a9 | 2005-07-07 17:56:02 -0700 | [diff] [blame] | 20 | #include <linux/fs.h> | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 21 |  | 
 | 22 | #include <asm/uaccess.h> | 
 | 23 |  | 
 | 24 | #define OSM_NAME	"config-osm" | 
| Markus Lidel | f6ed39a | 2006-01-06 00:19:33 -0800 | [diff] [blame] | 25 | #define OSM_VERSION	"1.323" | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 26 | #define OSM_DESCRIPTION	"I2O Configuration OSM" | 
 | 27 |  | 
 | 28 | /* access mode user rw */ | 
 | 29 | #define S_IWRSR (S_IRUSR | S_IWUSR) | 
 | 30 |  | 
 | 31 | static struct i2o_driver i2o_config_driver; | 
 | 32 |  | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 33 | /* Config OSM driver struct */ | 
 | 34 | static struct i2o_driver i2o_config_driver = { | 
 | 35 | 	.name = OSM_NAME, | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 36 | }; | 
 | 37 |  | 
 | 38 | #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL | 
 | 39 | #include "i2o_config.c" | 
 | 40 | #endif | 
 | 41 |  | 
 | 42 | /** | 
 | 43 |  *	i2o_config_init - Configuration OSM initialization function | 
 | 44 |  * | 
 | 45 |  *	Registers Configuration OSM in the I2O core and if old ioctl's are | 
 | 46 |  *	compiled in initialize them. | 
 | 47 |  * | 
 | 48 |  *	Returns 0 on success or negative error code on failure. | 
 | 49 |  */ | 
 | 50 | static int __init i2o_config_init(void) | 
 | 51 | { | 
 | 52 | 	printk(KERN_INFO OSM_DESCRIPTION " v" OSM_VERSION "\n"); | 
 | 53 |  | 
 | 54 | 	if (i2o_driver_register(&i2o_config_driver)) { | 
 | 55 | 		osm_err("handler register failed.\n"); | 
 | 56 | 		return -EBUSY; | 
 | 57 | 	} | 
 | 58 | #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL | 
| Deepak Saxena | 8b20f6d | 2005-09-21 09:55:35 -0700 | [diff] [blame] | 59 | 	if (i2o_config_old_init()) { | 
 | 60 | 		osm_err("old config handler initialization failed\n"); | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 61 | 		i2o_driver_unregister(&i2o_config_driver); | 
| Deepak Saxena | 8b20f6d | 2005-09-21 09:55:35 -0700 | [diff] [blame] | 62 | 		return -EBUSY; | 
 | 63 | 	} | 
| Markus Lidel | f10378f | 2005-06-23 22:02:16 -0700 | [diff] [blame] | 64 | #endif | 
 | 65 |  | 
 | 66 | 	return 0; | 
 | 67 | } | 
 | 68 |  | 
 | 69 | /** | 
 | 70 |  *	i2o_config_exit - Configuration OSM exit function | 
 | 71 |  * | 
 | 72 |  *	If old ioctl's are compiled in exit remove them and unregisters | 
 | 73 |  *	Configuration OSM from I2O core. | 
 | 74 |  */ | 
 | 75 | static void i2o_config_exit(void) | 
 | 76 | { | 
 | 77 | #ifdef CONFIG_I2O_CONFIG_OLD_IOCTL | 
 | 78 | 	i2o_config_old_exit(); | 
 | 79 | #endif | 
 | 80 |  | 
 | 81 | 	i2o_driver_unregister(&i2o_config_driver); | 
 | 82 | } | 
 | 83 |  | 
 | 84 | MODULE_AUTHOR("Markus Lidel <Markus.Lidel@shadowconnect.com>"); | 
 | 85 | MODULE_LICENSE("GPL"); | 
 | 86 | MODULE_DESCRIPTION(OSM_DESCRIPTION); | 
 | 87 | MODULE_VERSION(OSM_VERSION); | 
 | 88 |  | 
 | 89 | module_init(i2o_config_init); | 
 | 90 | module_exit(i2o_config_exit); |