This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Proposing tapset MAJOR(), MINOR(), and MKDEV() function
- From: "K.Prasad" <prasad at linux dot vnet dot ibm dot com>
- To: William Cohen <wcohen at redhat dot com>
- Cc: SystemTAP <systemtap at sources dot redhat dot com>
- Date: Fri, 20 Jun 2008 01:19:59 +0530
- Subject: Re: Proposing tapset MAJOR(), MINOR(), and MKDEV() function
- References: <485AAE81.8000100@redhat.com>
- Reply-to: prasad at linux dot vnet dot ibm dot com
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