From patchwork Mon Oct 20 17:03:27 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Travis X-Patchwork-Id: 5086 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id CF172DE084 for ; Tue, 21 Oct 2008 04:05:41 +1100 (EST) X-Original-To: linuxppc-dev@ozlabs.org Delivered-To: linuxppc-dev@ozlabs.org Received: from relay.sgi.com (relay1.sgi.com [192.48.171.29]) by ozlabs.org (Postfix) with ESMTP id DA8D0DDED0 for ; Tue, 21 Oct 2008 04:03:23 +1100 (EST) Received: from polaris-admin.engr.sgi.com (polaris-admin.engr.sgi.com [192.102.97.111]) by relay1.corp.sgi.com (Postfix) with ESMTP id 6CD458F8112; Mon, 20 Oct 2008 10:03:22 -0700 (PDT) Received: by polaris-admin.engr.sgi.com (Postfix, from userid 5508) id CC00D517CAFC; Mon, 20 Oct 2008 10:03:20 -0700 (PDT) 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 Subject: [PATCH 08/35] cpumask: cpumask_size() Content-Disposition: inline; filename=cpumask:cpumask_size.patch Cc: davej@codemonkey.org.uk, Jeremy Fitzhardinge , Jes Sorensen , IA64 , S390 , peterz@infradead.org, Jack Steiner , linux-kernel@vger.kernel.org, Eric Dumazet , PowerPC , Andi Kleen , Thomas Gleixner , Yinghai Lu , "H. Peter Anvin" , SPARC , Andrew Morton , David Miller X-BeenThere: linuxppc-dev@ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@ozlabs.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_;