LD_ISCSI.SO LD_PRELOAD hack
ld_iscsi.so is a small LD_PRELOAD hack that can be used to make normal unix utilities such as 'stat' and 'cat' become iSCSI 'aware' and fake handling an iSCSI URL as a normal read-only file. See README for examples.
This commit is contained in:
@@ -72,3 +72,31 @@ Header digest is to be used or not.
|
||||
This can be overridden by an application by calling iscsi_set_header_digest()
|
||||
if the application wants to force a specific setting.
|
||||
|
||||
|
||||
LD_PRELOAD FUN
|
||||
==============
|
||||
There is a small LD_PRELOAD hack in the src directory that intercepts a handful
|
||||
of system calls and converts ISCSI URLs to look and behave as if they are
|
||||
normal read-only files.
|
||||
This allows using standard unix tools to become iscsi aware with no modifications.
|
||||
|
||||
For example:
|
||||
The stat command: this shows the size of the iSCSI LUN as if it was a normal file:
|
||||
$ LD_PRELOAD=./bin/ld_iscsi.so stat iscsi://127.0.0.1:3262/iqn.ronnie.test/2
|
||||
File: `iscsi://127.0.0.1:3262/iqn.ronnie.test/2'
|
||||
Size: 3431540736 Blocks: 0 IO Block: 0 regular file
|
||||
Device: 0h/0d Inode: 0 Links: 0
|
||||
Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
|
||||
Access: 1970-01-01 10:00:00.000000000 +1000
|
||||
Modify: 1970-01-01 10:00:00.000000000 +1000
|
||||
Change: 1970-01-01 10:00:00.000000000 +1000
|
||||
|
||||
The cat command, which allows you to read/dump a iSCSI LUN to a file :
|
||||
$ LD_PRELOAD=./bin/ld_iscsi.so cat iscsi://127.0.0.1:3262/iqn.ronnie.test/2 >copy_of_iscsi_lun
|
||||
|
||||
|
||||
The LD_PRELOAD hack is incomplete and needs more functions to be intercepted before becomming fully functional. Patches welcome!
|
||||
|
||||
For now, it is sufficiently complete for trivial commands like stat and cat.
|
||||
You probably need to implement at least lseek, pread, pwrite before it becomes really useful.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user