From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoph Lameter Subject: [patch 02/21] slub: Replace ctor field with ops field in /sys/slab/* Date: Fri, 09 May 2008 20:08:33 -0700 Message-ID: <20080510030914.996139665@sgi.com> References: <20080510030831.796641881@sgi.com> Cc: linux-kernel@vger.kernel.org, Pekka Enberg To: akpm@linux-foundation.org Return-path: Received: from netops-testserver-3-out.sgi.com ([192.48.171.28]:55015 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751457AbYEJDJR (ORCPT ); Fri, 9 May 2008 23:09:17 -0400 CC: linux-fsdevel@vger.kernel.org Cc: Mel Gorman Cc: andi@firstfloor.org Cc: Rik van Riel Cc: mpm@selenic.com Content-Disposition: inline; filename=0002-SLUB-Replace-ctor-field-with-ops-field-in-sys-slab.patch Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Create an ops field in /sys/slab/*/ops to contain all the operations defined on a slab. This will be used to display the additional operations that will be defined soon. Reviewed-by: Rik van Riel Signed-off-by: Christoph Lameter Signed-off-by: Pekka Enberg --- mm/slub.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2008-05-05 18:48:42.745160406 -0700 +++ linux-2.6/mm/slub.c 2008-05-05 18:48:49.821409748 -0700 @@ -3832,16 +3832,18 @@ static ssize_t order_show(struct kmem_ca } SLAB_ATTR(order); -static ssize_t ctor_show(struct kmem_cache *s, char *buf) +static ssize_t ops_show(struct kmem_cache *s, char *buf) { - if (s->ctor) { - int n = sprint_symbol(buf, (unsigned long)s->ctor); + int x = 0; - return n + sprintf(buf + n, "\n"); + if (s->ctor) { + x += sprintf(buf + x, "ctor : "); + x += sprint_symbol(buf + x, (unsigned long)s->ctor); + x += sprintf(buf + x, "\n"); } - return 0; + return x; } -SLAB_ATTR_RO(ctor); +SLAB_ATTR_RO(ops); static ssize_t aliases_show(struct kmem_cache *s, char *buf) { @@ -4174,7 +4176,7 @@ static struct attribute *slab_attrs[] = &slabs_attr.attr, &partial_attr.attr, &cpu_slabs_attr.attr, - &ctor_attr.attr, + &ops_attr.attr, &aliases_attr.attr, &align_attr.attr, &sanity_checks_attr.attr, --