[PATCH] [Target_Core_Mod/ConfigFS]: Added CONFIGFS_SYSFS_SYMLINKSsupport

From: Nicholas A. Bellinger
Date: Fri Oct 17 2008 - 03:02:53 EST


Added allow_link_kobject() and drop_link_kobject() calls to
/sys/kernel/config/target/core/$HBA_$ID/$STORAGE_OBJECT

Then means the following code now works for accessing struct block_device
and struct scsi_device through Linux/BLOCK and Linux/SCSI subsystems
respectively.

export TARGET=/sys/kernel/config/target/core/
export FABRIC=/sys/kernel/config/target/iscsi/

mkdir -p $TARGET/iblock_0/lvm_test0
ln -s /sys/block/dm-2 $TARGET/iblock_0/lvm_test0/dm-2

mkdir -p $TARGET/pscsi_0/sdd
ln -s /sys/block/sdd/device $TARGET/pscsi_0/sdd/passthrough

export DEF_IQN="iqn.2003-01.org.linux-iscsi.target.i686:sn.e475ed6fcdd0"

<SNIP..>

mkdir -p "$FABRIC/$DEF_IQN/tpgt_1/lun/lun_0"
ln -s $TARGET/iblock_0/lvm_test0 "$FABRIC/$DEF_IQN/tpgt_1/lun/lun_0/lio_west_port"
mkdir -p "$FABRIC/$DEF_IQN/tpgt_1/lun/lun_1"
ln -s $TARGET/pscsi_0/sdd "$FABRIC/$DEF_IQN/tpgt_1/lun/lun_1/lio_east_port"

Signed-off-by: Nicholas A. Bellinger
---
drivers/lio-core/MCONFIG_TARGET | 1 +
drivers/lio-core/Makefile | 3 +
drivers/lio-core/target_core_configfs.c | 95 +++++++++++++++++++++++++++++-
drivers/lio-core/target_core_iblock.c | 18 ++++++
drivers/lio-core/target_core_iblock.h | 2 +
drivers/lio-core/target_core_plugin.c | 2 +-
drivers/lio-core/target_core_pscsi.c | 20 ++++++
drivers/lio-core/target_core_pscsi.h | 2 +
drivers/lio-core/target_core_transport.h | 4 +
9 files changed, 145 insertions(+), 2 deletions(-)

The commit can be found at:

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commit;h=7549c55a99139de114852f0e0b356f7ec0739b35

The commit that enables kobject symlinks in configfs can be found at:

http://git.kernel.org/?p=linux/kernel/git/nab/lio-core-2.6.git;a=commit;h=317aefe74354c0140dc8aebff1ef9467b6f0c9ba


Comments Folks..?

--nab

Attachment: 0002-Target_Core_Mod-ConfigFS-Added-CONFIGFS_SYSFS_SYM.patch
Description: application/mbox