From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757358AbcFAMbh (ORCPT ); Wed, 1 Jun 2016 08:31:37 -0400 Received: from mga03.intel.com ([134.134.136.65]:41491 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570AbcFAMbf (ORCPT ); Wed, 1 Jun 2016 08:31:35 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,401,1459839600"; d="scan'208";a="114092351" Message-ID: <1464784367.1767.8.camel@linux.intel.com> Subject: Re: [PATCH] lib/uuid.c: eliminate uuid_[bl]e_index arrays From: Andy Shevchenko To: Joe Perches , George Spelvin Cc: akpm@linux-foundation.org, bbjorn@mork.no, linux-kernel@vger.kernel.org, tytso@mit.edu Date: Wed, 01 Jun 2016 15:32:47 +0300 In-Reply-To: <1464730604.14627.66.camel@perches.com> References: <20160531203122.7243.qmail@ns.sciencehorizons.net> <1464730604.14627.66.camel@perches.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.2-2 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2016-05-31 at 14:36 -0700, Joe Perches wrote: > On Tue, 2016-05-31 at 16:31 -0400, George Spelvin wrote: > > Here's a patch implementing the suggestion I made earlier.  This > > reduces > > code size, data size, and run time for input and output of UUIDs. > [] > > diff --git a/lib/uuid.c b/lib/uuid.c > [] > > @@ -97,32 +97,28 @@ bool uuid_is_valid(const char *uuid) > >  } > >  EXPORT_SYMBOL(uuid_is_valid); > >   > > -static int __uuid_to_bin(const char *uuid, __u8 b[16], const u8 > > ei[16]) > > +static int __uuid_to_bin(const char uuid[36], __u8 b[16], const u8 > > si[16]) > > Functions with sized array arguments are generally undesired. That function follows existing UUID API. Since we have now it consolidated in one place someone may fix it eventually. Refer to this discussion as well: http://www.spinics.net/lists/linux-efi/msg08105.html > > Linus once wrote: (http://comments.gmane.org/gmane.linux.kernel/203140 > 0) > >     array arguments in C don't >     actually exist. Sadly, compilers accept it for various bad > historical >     reasons, and silently turn it into just a pointer argument. There > are >     arguments for them, but they are from weak minds. > > Perhaps this would be better using simple pointers and without the __ > > static int __uuid_to_bin(const char *uuid, u8 *b, const u8 *si) > -- Andy Shevchenko Intel Finland Oy