Am Freitag, 7. März 2014, 20:17:56 schrieb Greg KH:
> On Fri, Mar 07, 2014 at 11:38:03AM +0300, Dan Carpenter wrote:
> > drivers/staging/unisys/include/guidutils.h
> > 
> >     57  static inline char *
> >     58  GUID_format2(const GUID *guid, char *s)
> >     59  {
> >     60          sprintf(s,
> >     "{%-8.8lx-%-4.4x-%-4.4x-%-2.2x%-2.2x-%-2.2x%-2.2x%-2.2x%-2.2x%-2.2x%
> >     -2.2x}", 61                  (ulong) guid->data1,
> >     62                  guid->data2,
> >     63                  guid->data3,
> >     64                  guid->data4[0],
> >     65                  guid->data4[1],
> >     66                  guid->data4[2],
> >     67                  guid->data4[3],
> >     68                  guid->data4[4], guid->data4[5], guid->data4[6],
> >     guid->data4[7]); 69          return s;
> >     70  }
> > 
> > The 50 character buf size comes from the CHANNEL_GUID_MISMATCH() macros.
> > I'm not sure how it's calculating that it takes 63 characters.  printf
> > formats make my head hurt.  My test said the max was 95 characters?
> 
> There should be a built-in guid printk() macro (or function to do it)
> already in the kernel, so this code should be able to just be deleted
> entirely.


Yes there is
UUID/GUID addresses:

        %pUb    00010203-0405-0607-0809-0a0b0c0d0e0f
        %pUB    00010203-0405-0607-0809-0A0B0C0D0E0F
        %pUl    03020100-0504-0706-0809-0a0b0c0e0e0f
        %pUL    03020100-0504-0706-0809-0A0B0C0E0E0F

        For printing 16-byte UUID/GUIDs addresses. The additional 'l', 'L',
        'b' and 'B' specifiers are used to specify a little endian order in
        lower ('l') or upper case ('L') hex characters - and big endian order
        in lower ('b') or upper case ('B') hex characters.

        Where no additional specifiers are used the default little endian
        order with lower case hex characters will be printed.

From
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/printk-formats.txt?id=HEAD#n163


PeterH
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to