Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758299AbXJ2Rlf (ORCPT ); Mon, 29 Oct 2007 13:41:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754431AbXJ2RlY (ORCPT ); Mon, 29 Oct 2007 13:41:24 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:51005 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755145AbXJ2RlX (ORCPT ); Mon, 29 Oct 2007 13:41:23 -0400 Subject: Re: [PATCH] sysfs: add filter function to groups From: Kay Sievers To: James Bottomley Cc: Greg KH , linux-scsi , linux-kernel In-Reply-To: <1193678914.3383.79.camel@localhost.localdomain> References: <1193671019.3383.13.camel@localhost.localdomain> <1193676852.2655.21.camel@lov.site> <1193677071.3383.56.camel@localhost.localdomain> <1193678844.3782.7.camel@lov.site> <1193678914.3383.79.camel@localhost.localdomain> Content-Type: text/plain Date: Mon, 29 Oct 2007 18:43:19 +0100 Message-Id: <1193679799.3782.15.camel@lov.site> Mime-Version: 1.0 X-Mailer: Evolution 2.12.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19/O2hVgaG9sp2vrmeq/oeexY/3yVBcayP/W87 UlJKU+f1HmSWx9jTHhyo6N/XcCUw7BjPgVnC5biBYWOpp5jKBl QHfoeQVovks9SkgBKwsfjSRXXYjhZ1f Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1615 Lines: 38 On Mon, 2007-10-29 at 12:28 -0500, James Bottomley wrote: > On Mon, 2007-10-29 at 18:27 +0100, Kay Sievers wrote: > > On Mon, 2007-10-29 at 11:57 -0500, James Bottomley wrote: > > > On Mon, 2007-10-29 at 17:54 +0100, Kay Sievers wrote: > > > > On Mon, 2007-10-29 at 10:16 -0500, James Bottomley wrote: > > > > > > > struct attribute_group { > > > > > const char *name; > > > > > + int (*filter_show)(struct kobject *, int); > > > > > > > > Are you sure that you want to return an array index here, instead of the > > > > actual attribute? Like: > > > > > > Actually, it returns a true/false value indicating whether the given > > > attribute should be displayed. > > > > It isn't about the return value of the function, that's fine. You call > > back with the index number (int) of the array of attributes, instead of > > passing the attribute pointer (struct attribute *attr) back to ask the > > device for the attribute to create. > > For bitmaps, the int is what we will want. I can add both to the > prototype if that will make you happy? so people searching on struct > attribute and not relying on the array construction order can use the > code as well. Having both parameters sounds fine. Otherwise, if the code is spread around several files, the attribute arrays would need to be global to handle the callbacks, which isn't too nice. Thanks, Kay - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/