Proposing tapset MAJOR(), MINOR(), and MKDEV() function
K.Prasad
prasad@linux.vnet.ibm.com
Fri Jun 20 17:04:00 GMT 2008
On Thu, Jun 19, 2008 at 03:07:45PM -0400, William Cohen wrote:
> Hi All,
>
> I have been working on cleaning up the war stories and including them
> in the regular testing. A number of the warstories(WSDeviceMonitor,
> WSFileMonitor, and WSFileMonitor2) make use of the device number
> information. The examples extract the device number out of a
> dev_t. Right now the examples are a bit awkward. The examples use stat
> to get determine the major and minor number, but the actual feeding to
> the script requires some manual munging. From WSDeviceMonitor:
>
> $ ls -laF /dev/sdc1
> brw-r----- 1 root disk 8, 33 2007-06-12 20:25 /dev/sdc1
> $ stap traceio2.stp 8 33
>
> It seems like it would be nicer to allow the use the output of stat
> directly. Something like:
>
> stap traceio2.stp `stat -c "0x%t 0x%T" /dev/sdc1`
>
> It might be useful to have wrappers functions in systemtap to make
> handling major and minor device numbers a bit more portable:
>
> MAJOR(kdev_t dev) extract major device number
> MINOR(kdev_t dev) extract minor device number
Should we call them MAJOR_DEV, MINOR_DEV to avoid any future namespace
clashes?
This seems a nice idea to me and can avoid tapset clutter.
Thanks,
K.Prasad
More information about the Systemtap
mailing list