From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Fleming Subject: Re: [PATCH 2/2] efivarfs: guid part of filenames are case-insensitive Date: Tue, 12 Feb 2013 12:31:49 +0000 Message-ID: <20130212123149.GA14790@console-pimps.org> References: <1360592935-26026-1-git-send-email-matt@console-pimps.org> <1360592935-26026-3-git-send-email-matt@console-pimps.org> <20130211152221.GL4503@ZenIV.linux.org.uk> <20130211160557.GB26681@console-pimps.org> <20130211173057.GM4503@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20130211173057.GM4503-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org> Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Al Viro Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Lingzhu Xiang , Matthew Garrett , Jeremy Kerr , Matt Fleming List-Id: linux-efi@vger.kernel.org On Mon, 11 Feb, at 05:30:57PM, Al Viro wrote: > On Mon, Feb 11, 2013 at 04:05:57PM +0000, Matt Fleming wrote: > > > Egads, man... > > > [snip the horror with copying the name] > > > > > > unsigned long hash = init_name_hash(); > > > const unsigned char *s = qstr->name; > > > int len = qstr->len; > > > > > > if (!efivarfs_valid_name(s, len)) > > > return -EINVAL; > > > while (len-- > GUID_LEN) > > > hash = partial_name_hash(*s++, hash); > > > /* GUID is case-insensitive. */ > > > while (len--) > > > hash = partial_name_hash(tolower(*s++), hash); > > > return end_name_hash(hash); > > > > Oh, wow, yes that is much nicer. I didn't realise we could build the > > hash incrementally like that. Very cool. > > ... except that it should end with qstr->hash = end_name_hash(hash); return 0; > instead. My apologies. Oh, efivarfs also needs to stop using d_alloc_name(), which calls full_name_hash(), because we now need to use our fs-specific hash function. Updated versions of both patches coming shortly. -- Matt Fleming, Intel Open Source Technology Center