From owner-freebsd-geom@FreeBSD.ORG Thu Jan 15 08:05:15 2009 Return-Path: Delivered-To: geom@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27F071065672 for ; Thu, 15 Jan 2009 08:05:15 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id E2E678FC1C for ; Thu, 15 Jan 2009 08:05:14 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id BF39573098; Thu, 15 Jan 2009 09:10:25 +0100 (CET) Date: Thu, 15 Jan 2009 09:10:25 +0100 From: Luigi Rizzo To: geom@freebsd.org, Luigi Rizzo Message-ID: <20090115081025.GA76218@onelab2.iet.unipi.it> References: <20090113122111.GA89189@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090113122111.GA89189@onelab2.iet.unipi.it> User-Agent: Mutt/1.4.2.3i Cc: Subject: recursion check in 'taste' functions ? X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jan 2009 08:05:15 -0000 Hi, I notice that the check to prevent recursion in the 'taste' function is always based on a string comparison, written in various forms, e.g., if (strcmp(pp->geom->class->name, mp->name) == 0) return (NULL); ... if (!strcmp(pp->geom->class->name, MBR_CLASS_NAME)) return (NULL); Wouldn't the following be more efficient (and perhaps correct) ? if (pp->geom->class == mp) return (NULL); This is because pp->geom->class is always initialized with a pointer to the class descriptor, and I guess it cannot be different... cheers luigi