This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Proposing tapset MAJOR(), MINOR(), and MKDEV() function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]