staging: visorchannel module

Peter Hüwe PeterHuewe at gmx.de
Fri Mar 7 19:38:03 UTC 2014


Am Freitag, 7. März 2014, 20:28:20 schrieb Peter Hüwe:
> 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:


Or atleast for the  guid->data4[x] fields

Raw buffer as a hex string:
	%*ph	00 01 02  ...  3f
	%*phC	00:01:02: ... :3f
	%*phD	00-01-02- ... -3f
	%*phN	000102 ... 3f

	For printing a small buffers (up to 64 bytes long) as a hex string with
	certain separator. For the larger buffers consider to use
	print_hex_dump().


PeterH


More information about the devel mailing list