lkml.org 
[lkml]   [2011]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 6/7] char/mei: Header file contain the Userland API, (IOCTL and its struct)
Date
On Tuesday 22 March 2011, Greg KH wrote:
> On Tue, Mar 22, 2011 at 12:51:31PM +0200, Oren Weil wrote:
> > +/*
> > + * Intel MEI client information struct
> > + */
> > +struct mei_client {
> > + u32 max_msg_length;
> > + u8 protocol_version;
> > + u8 reserved[3];
> > +} __packed;
>
> As this is passing the kernel/user boundry, you need to use the proper
> data types for it.
>
> So use __u32 and __u8 here please.

Also, __packed should not be used in APIs, because it is a gcc extension
and makes the code less efficient.

> > +/*
> > + * IOCTL Connect Client Data structure
> > + */
> > +struct mei_connect_client_data {
> > + union {
> > + uuid_le in_client_uuid;
> > + struct mei_client out_client_propeties;
> > + } d;
>
> Why not an anonymous union?

That would also incompatible with some compilers. I would recommend
not using a union at all, but simply to put all in one struct.

Arnd


\
 
 \ /
  Last update: 2011-03-22 17:43    [W:0.068 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site