From 629e749b569bebf3e8fa841b9c62f70e545c5db6 Mon Sep 17 00:00:00 2001 From: Nicholas Bellinger Date: Wed, 11 Jul 2012 13:29:47 -0700 Subject: [PATCH] --- yaml --- r: 312667 b: refs/heads/master c: 182a9e2cef7bb7017f95bd1b9f27fb81b97f07de h: refs/heads/master i: 312665: 085cf4f4e26d1864127468690bf835ed7282f95b 312663: a4b059b395debfeb378c6c6b3a0a798b62bc9cd8 v: v3 --- [refs] | 2 +- trunk/drivers/target/target_core_configfs.c | 38 +++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 10ef9f80ba84..c0030d857981 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 14150a6bbe9e15ce8e7a4f79047c2b4284a51b3d +refs/heads/master: 182a9e2cef7bb7017f95bd1b9f27fb81b97f07de diff --git a/trunk/drivers/target/target_core_configfs.c b/trunk/drivers/target/target_core_configfs.c index 37c4bf3be43a..801efa892046 100644 --- a/trunk/drivers/target/target_core_configfs.c +++ b/trunk/drivers/target/target_core_configfs.c @@ -122,9 +122,47 @@ static struct config_group *target_core_register_fabric( const char *name) { struct target_fabric_configfs *tf; + int ret; pr_debug("Target_Core_ConfigFS: REGISTER -> group: %p name:" " %s\n", group, name); + /* + * Below are some hardcoded request_module() calls to automatically + * local fabric modules when the following is called: + * + * mkdir -p /sys/kernel/config/target/$MODULE_NAME + * + * Note that this does not limit which TCM fabric module can be + * registered, but simply provids auto loading logic for modules with + * mkdir(2) system calls with known TCM fabric modules. + */ + if (!strncmp(name, "iscsi", 5)) { + /* + * Automatically load the LIO Target fabric module when the + * following is called: + * + * mkdir -p $CONFIGFS/target/iscsi + */ + ret = request_module("iscsi_target_mod"); + if (ret < 0) { + pr_err("request_module() failed for" + " iscsi_target_mod.ko: %d\n", ret); + return ERR_PTR(-EINVAL); + } + } else if (!strncmp(name, "loopback", 8)) { + /* + * Automatically load the tcm_loop fabric module when the + * following is called: + * + * mkdir -p $CONFIGFS/target/loopback + */ + ret = request_module("tcm_loop"); + if (ret < 0) { + pr_err("request_module() failed for" + " tcm_loop.ko: %d\n", ret); + return ERR_PTR(-EINVAL); + } + } tf = target_core_get_fabric(name); if (!tf) {