Operating System - HP-UX
1827260 Members
2160 Online
109717 Solutions
New Discussion

Re: systemcalls for the lvm

 
SOLVED
Go to solution
Stefan Koch
Occasional Contributor

systemcalls for the lvm

i want to get information about the location of a logical volume on a physical volume. i know how i do this if the logical volume is only located on one physical volume but if it contains to more than one physical volume i don't know what i have to do. i tried a systemcall like 'pstat_getlv' (thanks john) but this information i have got was not enough for me.

i need a solution for a c/c++ programm, so it is not so easy scanning the output of the 'lvdisplay' command

hope for help

stefan
2 REPLIES 2
Stefan Farrelly
Honored Contributor
Solution

Re: systemcalls for the lvm


HP keep the lvm stuff pretty close to their chest as its part of HP-UX's source code.

I dont think youre going to have much luck finding the C call you want, youre going to have to do it the long way and call a shell to do a lvdisplay -v or pvdisplay and suck the results back into your C program.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Daniel Proulx
Occasional Advisor

Re: systemcalls for the lvm

HP's LVM implementation comes from the time the OSF (Open Software Foundation) was more active. LVM was a contribution from IBM to OSF and HP got their LVM base from there. IBM released their LVM code to the open source community for porting to Linux. Have a look at http://www.sistina.com/lvm/ or more precisely http://www.sistina.com/lvm/Pages/intro.html. You could get some source code overthere too.

If you're willing to do some reverse engineering, you may also consider using 'tusc' to get a trace of system calls used by lvdisplay to get the information. 'tusc' is for HP-UX 11.x, it would be 'trace' on HP-UX 10.20 (see http://hpux.cs.utah.edu/ for these utilities).

Example:

tusc -v /usr/sbin/lvdisplay -v /dev/vg00/lvol1

After getting info from /etc/lvmtab, lvdisplay does a serie of ioctl() as follows:

open("/dev/vg00/group", O_RDWR, 02) ...... = 4
stat("/dev/vg00/lvol1", 0x7f7e0e90) .............................. = 0
fstat(4, 0x7f7e0ee8) ................................. = 0
ioctl(4, 0xc01c7633, 0x7f7e0dc0) ............... = 0
Command: _IOWR('v', 51, 28)
Data:
\00103\0\0\0\019\019\019\a) \002\0\0\0\0\0\0\003\0\0\0\0
ioctl(4, 0xc0207612, 0x7f7e0df0) ............... = 0
Command: _IOWR('v', 18, 32)
Data:
045 e6ef8 9090ee\0ff\010\tc4\0\0\0@ \0\0\0c2\0\t\003\00301fc\0\0
ioctl(4, 0xc01c7633, 0x7f7e1790) ............... = 0
Command: _IOWR('v', 51, 28)
Data:
\001\0\0\0\0\019\019\019\a) \002\0\0\0\0\0\0\0\0\0\0\0\0
ioctl(4, 0xc00c760d, 0x7f7e17ac) ................ = 0
Command: _IOWR('v', 13, 12)
Data:
\0011793\0\0\019@ 160610
ioctl(4, 0xc0207610, 0x40160940) ............... = 0
Command: _IOWR('v', 16, 32)
Data:
@ 1606( \0\002\001fb\0\0\0@ \0\01f\0` \0\veb\vec\0\0\0\001\001\0
ioctl(4, 0xc0207610, 0x40160960) ............... = 0
Command: _IOWR('v', 16, 32)
Data:
@ 1606@ \00102\001fc\0\0\0@ \0\01f\0P \003K 03L \0\0\0\001\001\0
ioctl(4, 0xc0207610, 0x40160980) ............... = 0
Command: _IOWR('v', 16, 32)
Data:
@ 1606X \00202\001fc\0c2\0@ \0\01f\0@ \003K 03L \0\0\0\001\001\0
ioctl(1, TCGETA, 0x7f7e1a38) ..... ERR#25 ENOTTY
Command: _IOR('T', 1, 18)

Just repeat the process and try to detect any patterns.


Daniel.