Operating System - HP-UX
1753483 Members
4157 Online
108794 Solutions
New Discussion юеВ

Re: How to get deveice name in kernel

 
mark.wang
New Member

How to get deveice name in kernel

I using vfs struct -> vfs_name to get the device name, but when I tests at root device,I get the "/dev/root" ,not really logic device name like "/dev/vg00/lvol7".
7 REPLIES 7
avizen9
Esteemed Contributor

Re: How to get deveice name in kernel

what is your bdf output?
if you will get /dev/root mean its not in vg and when you are getting /dev/vg00/lvol7 mean it configure as volume group, thanks,
mark.wang
New Member

Re: How to get deveice name in kernel

Thanks!
Using the "bdf" command can get correct result, it show that the root "/" was mounted on "/dev/vg00/lvo17".

Any idea? , How to using vfs struct at code to get device name? is it need to translate ?

other issue: I used vfs struct at my code can get device name correctly except the root "/" device.
mark.wang
New Member

Re: How to get deveice name in kernel

bash-3.2# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 2097152 1335824 761328 64% /
/dev/vg00/lvol1 298928 61008 208024 23% /stand
/dev/vg00/lvol7 8388608 2121872 6217800 25% /var
/dev/vg00/lvol6 10485760 1788024 8629840 17% /usr
/dev/vg00/lvol5 5242880 825520 4383280 16% /tmp
/dev/vg00/lvol8 8912896 2622408 6242024 30% /opt
/dev/vg00/lvol4 32030720 28569496 3461224 89% /home

mark.wang
New Member

Re: How to get deveice name in kernel

can somebody can help me? or please move this thread to other Categories?

Re: How to get deveice name in kernel

Mark,

I think some context would help here - what are you trying to acheive? Is the only way to acheive this by fishing around in memory or a kernel dump?

Generally I'd always tell people to avoid digging into the kernel if there's a user space method of doing whyat you are attempting - a lot of stuff thats supposed to be purely internal to the kernel can change without warning and with no backwards compatibility, so its best avoided.

Anyway IIRC /dev/root is a special case thats used before the LVM device drivers are stood up to get at the root filesystem, so it should always relate to the device on which / is mounted. It's not surprising that this is what the kernel sees, as its started before LVM starts.

HTH

Duncan

I am an HPE Employee
Accept or Kudo
mark.wang
New Member

Re: How to get deveice name in kernel

Thank you very much to Duncan ├п┬╝ ├п┬╝

My point is : we need to get some information ( device name, process name...) of a spacial "file" we care when catching some system call. then We can logging this information for backup.
So , it is seem that getting these information in kernel directly for reasons of efficiency.

maybe , it can do some translation while doing the logs. let "/dev/root" to really logic device.
Dennis Handly
Acclaimed Contributor

Re: How to get deveice name in kernel

>we need to get some information (device name, process name...) of a special "file" we care when catching some system call.

I assume you are writing a device driver? You might want to be explicit about it.

Have you looked at the DDK? What OS version?
http://www.hp.com/go/hpux_ddk