From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 2 Aug 2007 16:08:51 +0200 (CEST) From: Jan Engelhardt Subject: Re: [PATCH] type safe allocator In-Reply-To: <1186063605.8085.82.camel@tara.firmix.at> Message-ID: References: <1186062476.12034.115.camel@twins> <1186063605.8085.82.camel@tara.firmix.at> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Bernd Petrovitsch Cc: Peter Zijlstra , Alexey Dobriyan , Miklos Szeredi , akpm@linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, torvalds@linux-foundation.org List-ID: On Aug 2 2007 16:06, Bernd Petrovitsch wrote: >> thrice in some cases like alloc_struct(struct task_struct, GFP_KERNEL) > >Save the explicit "struct" and put it into the macro (and force people >to not use typedefs). > >#define alloc_struct(type, flags) ((type *)kmalloc(sizeof(struct type), (flags))) #define alloc_struct(type, flags) ((struct type *)kmalloc(sizeof(struct type), (flags))) >Obious drawback: We may need alloc_union(). >SCNR. And we still don't have something to allocate a bunch of ints. [kmalloc(sizeof(int)*5,GFP)] Jan -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org