[PATCH v1] Changing print_dev_t to print raw device number if -Xraw

shankarapailoor shankarapailoor at gmail.com
Sat Dec 1 22:37:29 UTC 2018


Thanks Dmitry! I will add tests for all these changes and resubmit
On Sat, Dec 1, 2018 at 2:34 PM Dmitry V. Levin <ldv at altlinux.org> wrote:
>
> On Sat, Dec 01, 2018 at 12:10:47PM -0800, shankarapailoor wrote:
> > Hi,
> >
> > Attached is a patch to change print_dev_t to print the raw device
> > number if -Xraw is passed. Making this an attachment since gmail
> > converts tabs to spaces.
> >
> > Regards,
> > Shankara
>
> > From 5ee7545cbf615b4f1a57ad54b588db0cb5448919 Mon Sep 17 00:00:00 2001
> > From: Shankara Pailoor <shankarapailoor at gmail.com>
> > Date: Sat, 1 Dec 2018 12:08:07 -0800
> > Subject: [PATCH v1] Changing print_dev_t to print raw device number if -Xraw
> >  is passed.
> >
> > ---
> >  print_dev_t.c | 12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/print_dev_t.c b/print_dev_t.c
> > index 9b62f842..453b2381 100644
> > --- a/print_dev_t.c
> > +++ b/print_dev_t.c
> > @@ -33,5 +33,17 @@
> >  void
> >  print_dev_t(const unsigned long long dev)
> >  {
> > +     if (xlat_verbose(xlat_verbosity) != XLAT_STYLE_ABBREV)
> > +             tprintf("%llu", dev);
> > +
> > +     if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_RAW)
> > +             return;
> > +
> > +     if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
> > +             tprints(" /* ");
> > +
> >       tprintf("makedev(%u, %u)", major(dev), minor(dev));
> > +
> > +     if (xlat_verbose(xlat_verbosity) == XLAT_STYLE_VERBOSE)
> > +             tprints("*/");
> >  }
>
> This looks good, but have you considered printing the raw value in hex?
> Looking at this parser, I think it would be better if major and minor numbers
> were printed in hex, too.  For example, stat(1) prints them in hex.
>
> Also, please add a test for this change.
>
>
> --
> ldv
> --
> Strace-devel mailing list
> Strace-devel at lists.strace.io
> https://lists.strace.io/mailman/listinfo/strace-devel



-- 
Regards,
Shankara Pailoor


More information about the Strace-devel mailing list