diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_configfs.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 37c4bf3be43a..801efa892046 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -122,9 +122,47 @@ static struct config_group *target_core_register_fabric( | |||
122 | const char *name) | 122 | const char *name) |
123 | { | 123 | { |
124 | struct target_fabric_configfs *tf; | 124 | struct target_fabric_configfs *tf; |
125 | int ret; | ||
125 | 126 | ||
126 | pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:" | 127 | pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:" |
127 | " %s\n", group, name); | 128 | " %s\n", group, name); |
129 | /* | ||
130 | * Below are some hardcoded request_module() calls to automatically | ||
131 | * local fabric modules when the following is called: | ||
132 | * | ||
133 | * mkdir -p /sys/kernel/config/target/$MODULE_NAME | ||
134 | * | ||
135 | * Note that this does not limit which TCM fabric module can be | ||
136 | * registered, but simply provids auto loading logic for modules with | ||
137 | * mkdir(2) system calls with known TCM fabric modules. | ||
138 | */ | ||
139 | if (!strncmp(name, "iscsi", 5)) { | ||
140 | /* | ||
141 | * Automatically load the LIO Target fabric module when the | ||
142 | * following is called: | ||
143 | * | ||
144 | * mkdir -p $CONFIGFS/target/iscsi | ||
145 | */ | ||
146 | ret = request_module("iscsi_target_mod"); | ||
147 | if (ret < 0) { | ||
148 | pr_err("request_module() failed for" | ||
149 | " iscsi_target_mod.ko: %d\n", ret); | ||
150 | return ERR_PTR(-EINVAL); | ||
151 | } | ||
152 | } else if (!strncmp(name, "loopback", 8)) { | ||
153 | /* | ||
154 | * Automatically load the tcm_loop fabric module when the | ||
155 | * following is called: | ||
156 | * | ||
157 | * mkdir -p $CONFIGFS/target/loopback | ||
158 | */ | ||
159 | ret = request_module("tcm_loop"); | ||
160 | if (ret < 0) { | ||
161 | pr_err("request_module() failed for" | ||
162 | " tcm_loop.ko: %d\n", ret); | ||
163 | return ERR_PTR(-EINVAL); | ||
164 | } | ||
165 | } | ||
128 | 166 | ||
129 | tf = target_core_get_fabric(name); | 167 | tf = target_core_get_fabric(name); |
130 | if (!tf) { | 168 | if (!tf) { |