[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070625220118.199f86a8.akpm@linux-foundation.org>
Date: Mon, 25 Jun 2007 22:01:18 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Roman Zippel <zippel@...ux-m68k.org>
Cc: Duane Griffin <duaneg@...da.com>, linux-kernel@...r.kernel.org,
didier <did447@...il.com>, Solra Bizna <sbizna@...at.net>,
Daniel Drake <dsd@...too.org>
Subject: Re: [patch 2/2] HFS+: Add custom dentry hash and comparison
operations
On Mon, 25 Jun 2007 14:17:19 +0200 (CEST) Roman Zippel <zippel@...ux-m68k.org> wrote:
> +/*
> + * Hash a string to an integer as appropriate for the HFS+ filesystem.
> + * Composed unicode characters are decomposed and case-folding is performed
> + * if the appropriate bits are (un)set on the superblock.
> + */
> +int hfsplus_hash_dentry(struct dentry *dentry, struct qstr *str)
> +{
> + struct super_block *sb = dentry->d_sb;
> + const char *astr;
> + const u16 *dstr;
> + int casefold, decompose, size, dsize, len;
> + unsigned long hash;
> + wchar_t c;
> + u16 c2;
> +
> + casefold = (HFSPLUS_SB(sb).flags & HFSPLUS_SB_CASEFOLD);
> + decompose = !(HFSPLUS_SB(sb).flags & HFSPLUS_SB_NODECOMPOSE);
> + hash = init_name_hash();
> + astr = str->name;
> + len = str->len;
> + while (len > 0) {
> + size = asc2unichar(sb, astr, len, &c);
> + astr += size;
> + len -= size;
> +
> + if (decompose && (dstr = decompose_unichar(c, &dsize))) {
> + do {
> + c2 = *dstr++;
> + if (!casefold || (c2 = case_fold(c2)))
> + hash = partial_name_hash(c2, hash);
> + } while (--dsize > 0);
Are you really sure that we cannot start this loop with dsize==0? This isn't
obviously true to these bleary eyes.
> + } else {
> + c2 = c;
> + if (!casefold || (c2 = case_fold(c2)))
> + hash = partial_name_hash(c2, hash);
> + }
> + }
> + str->hash = end_name_hash(hash);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists