This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


Re: [Xen-devel] Re: [PATCH] sysfs attributes for xen

On Mon, Jan 30, 2006 at 05:53:30PM +0000, Keir Fraser wrote:
> On 30 Jan 2006, at 17:38, Dave Hansen wrote:
> >Yes, they are.  Buuuuuuut, you _can_ make the code around them a little
> >less evil.  If you _must_ use a typedef, you could do something like
> >this:
> >
> >#define XEN_CAP_INFO_LEN_BYTES 1024
> >typedef char [XEN_CAP_INFO_LEN_BYTES] xen_capabilities_info_t;
> Is that really better than just referencing the typedef? I've always 
> considered them okay for simple scalar and array types, even if they 
> are to be avoided for structure types. Is it the size aspect that is 
> the problem (e.g., a typedef'ed type should be okay to allocate on the 
> stack)?

No, a typedef for a simple array in the kernel is just foolish.  Please
read the archives and my old OLS paper on coding style as to why
typedefs are not acceptable in the kernel, except for a very few core
types (and you should not be creating those types of objects...)


greg k-h

Xen-devel mailing list