How to enumerate and access system devices(visual lvm)

In Visual LVM, We need to enumerate all disks and volumes to identify LVM information. Now we use the followed scripts

enumerate disk: #define ENUM_DISK (PCHAR)
“mdcfg=’’;if [ -d /dev/md ];then mdcfg=cat /proc/mdstat;fi;”
“title=fdisk -l|grep dev|head -1|awk '{print $1}';”
“list=fdisk -l|grep $title|grep dev|awk '{print $2}'|sed 's/://'|sed 's@/dev/ram@@'|sed 's@/dev/loop@@';”
“result=’’;”
"for dev in ls /dev/; do "
"[ “echo $list|grep /dev/$dev” != ‘’ ] && "
“[ ! -d /dev/$dev ]&&[ “$mdcfg|awk '{print $1}'|grep $dev” != “$dev” ]&&”
“echo /dev/$dev;”
“done”

enumerate filsystem:

#define ENUM_FORMAT_TYPE (PCHAR)"find /usr/sbin -name 'mkfs.*'|sed 's/\/usr\/sbin\/mkfs.//';find /sbin -name 'mkfs.*'|sed 's/\/sbin\/mkfs.//'"

and enumerate parts available(for blue print): #define ENUM_METHOD (char*)"list=fdisk -l|grep “/dev”|awk ‘{print $1}’|grep “/dev/”;lvs|awk ‘{print “/dev/”$2"/"$1}’|sed ‘1d’;echo \"$list\""

After devices/object founded, we need to access or use them.

for this case we have tried many interface such as block-device, system-files, … etc. But we fail to let them work.

So anyone can help us?

Thanks!