From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754226AbYJTRDq (ORCPT ); Mon, 20 Oct 2008 13:03:46 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753908AbYJTRD0 (ORCPT ); Mon, 20 Oct 2008 13:03:26 -0400 Received: from relay1.sgi.com ([192.48.171.29]:55220 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753317AbYJTRDX (ORCPT ); Mon, 20 Oct 2008 13:03:23 -0400 Message-Id: <20081020170320.713010000@polaris-admin.engr.sgi.com> References: <20081020170319.539427000@polaris-admin.engr.sgi.com> User-Agent: quilt/0.46-1 Date: Mon, 20 Oct 2008 10:03:27 -0700 From: Mike Travis To: Ingo Molnar , Rusty Russell Cc: Andi Kleen , Andrew Morton , davej@codemonkey.org.uk, David Miller , Eric Dumazet , Jack Steiner , Jeremy Fitzhardinge , Jes Sorensen , "H. Peter Anvin" , peterz@infradead.org, Thomas Gleixner , Yinghai Lu , IA64 , PowerPC , S390 , SPARC , linux-kernel@vger.kernel.org Subject: [PATCH 08/35] cpumask: cpumask_size() Content-Disposition: inline; filename=cpumask:cpumask_size.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dynamic allocation of cpumasks requires the size. Signed-off-by: Mike Travis --- include/linux/cpumask.h | 6 ++++++ 1 file changed, 6 insertions(+) --- test-compile.orig/include/linux/cpumask.h +++ test-compile/include/linux/cpumask.h @@ -64,6 +64,7 @@ * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids * + * size_t cpumask_size() Length of cpumask in bytes. * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set * (can be used as an lvalue) * CPU_MASK_ALL Initializer - all bits set @@ -148,6 +149,11 @@ struct cpumask }; #define cpumask_bits(maskp) ((maskp)->bits) +static inline ssize_t cpumask_size(void) +{ + return BITS_TO_LONGS(NR_CPUS) * sizeof(long); +} + /* Deprecated. */ typedef struct cpumask cpumask_t; extern cpumask_t _unused_cpumask_arg_; --