From: Ben Myers <bpm@sgi.com> To: linux-fsdevel@vger.kernel.org Cc: xfs@oss.sgi.com, olaf@sgi.com, tinguely@sgi.com Subject: [PATCH 04/13] libxfs: change interface of xfs_nameops.normhash Date: Thu, 18 Sep 2014 15:35:55 -0500 [thread overview] Message-ID: <20140918203555.GR4482@sgi.com> (raw) In-Reply-To: <20140918203114.GN4482@sgi.com> From: Olaf Weber <olaf@sgi.com> With the introduction of the xfs_nameops.normhash callout, all uses of the hashname callout now occur in places where an xfs_name structure must be explicitly created just to match the parameter passing convention of this callout. Change the arguments to a const unsigned char * and int instead. Signed-off-by: Olaf Weber <olaf@sgi.com> --- db/check.c | 6 ++---- include/xfs_da_btree.h | 2 +- libxfs/xfs_da_btree.c | 9 +-------- libxfs/xfs_dir2.c | 10 ++++++---- libxfs/xfs_dir2_block.c | 5 +---- libxfs/xfs_dir2_data.c | 6 ++---- repair/phase6.c | 2 +- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/db/check.c b/db/check.c index 4fd9fd0..49359d7 100644 --- a/db/check.c +++ b/db/check.c @@ -2212,7 +2212,6 @@ process_data_dir_v2( int stale = 0; int tag_err; __be16 *tagp; - struct xfs_name xname; data = iocur_top->data; block = iocur_top->data; @@ -2323,9 +2322,8 @@ process_data_dir_v2( tag_err += be16_to_cpu(*tagp) != (char *)dep - (char *)data; addr = xfs_dir2_db_off_to_dataptr(mp, db, (char *)dep - (char *)data); - xname.name = dep->name; - xname.len = dep->namelen; - dir_hash_add(mp->m_dirnameops->hashname(&xname), addr); + dir_hash_add(mp->m_dirnameops->hashname(dep->name, + dep->namelen), addr); ptr += xfs_dir3_data_entsize(mp, dep->namelen); count++; lastfree = 0; diff --git a/include/xfs_da_btree.h b/include/xfs_da_btree.h index 06b50bf..9674bed 100644 --- a/include/xfs_da_btree.h +++ b/include/xfs_da_btree.h @@ -132,7 +132,7 @@ typedef struct xfs_da_state { * Name ops for directory and/or attr name operations */ struct xfs_nameops { - xfs_dahash_t (*hashname)(struct xfs_name *); + xfs_dahash_t (*hashname)(const unsigned char *, int); int (*normhash)(struct xfs_da_args *); enum xfs_dacmp (*compname)(struct xfs_da_args *, const unsigned char *, int); diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index eb97317..7be5eaf 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -1993,13 +1993,6 @@ xfs_da_compname( XFS_CMP_EXACT : XFS_CMP_DIFFERENT; } -static xfs_dahash_t -xfs_default_hashname( - struct xfs_name *name) -{ - return xfs_da_hashname(name->name, name->len); -} - STATIC int xfs_da_normhash( struct xfs_da_args *args) @@ -2009,7 +2002,7 @@ xfs_da_normhash( } const struct xfs_nameops xfs_default_nameops = { - .hashname = xfs_default_hashname, + .hashname = xfs_da_hashname, .normhash = xfs_da_normhash, .compname = xfs_da_compname }; diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index e52d082..1893931 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -43,13 +43,14 @@ const unsigned char xfs_mode_to_ftype[S_IFMT >> S_SHIFT] = { */ STATIC xfs_dahash_t xfs_ascii_ci_hashname( - struct xfs_name *name) + const unsigned char *name, + int len) { xfs_dahash_t hash; int i; - for (i = 0, hash = 0; i < name->len; i++) - hash = tolower(name->name[i]) ^ rol32(hash, 7); + for (i = 0, hash = 0; i < len; i++) + hash = tolower(name[i]) ^ rol32(hash, 7); return hash; } @@ -475,7 +476,8 @@ xfs_dir_canenter( args.name = name->name; args.namelen = name->len; args.filetype = name->type; - args.hashval = dp->i_mount->m_dirnameops->hashname(name); + args.hashval = dp->i_mount->m_dirnameops->hashname(name->name, + name->len); args.dp = dp; args.whichfork = XFS_DATA_FORK; args.trans = tp; diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index 2880431..1a8b5f5 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -1047,7 +1047,6 @@ xfs_dir2_sf_to_block( xfs_dir2_sf_hdr_t *sfp; /* shortform header */ __be16 *tagp; /* end of data entry */ xfs_trans_t *tp; /* transaction pointer */ - struct xfs_name name; struct xfs_ifork *ifp; trace_xfs_dir2_sf_to_block(args); @@ -1205,10 +1204,8 @@ xfs_dir2_sf_to_block( tagp = xfs_dir3_data_entry_tag_p(mp, dep); *tagp = cpu_to_be16((char *)dep - (char *)hdr); xfs_dir2_data_log_entry(tp, bp, dep); - name.name = sfep->name; - name.len = sfep->namelen; blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> - hashname(&name)); + hashname(sfep->name, sfep->namelen)); blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, (char *)dep - (char *)hdr)); offset = (int)((char *)(tagp + 1) - (char *)hdr); diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index dc9df4d..9b3f750 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -46,7 +46,6 @@ __xfs_dir3_data_check( xfs_mount_t *mp; /* filesystem mount point */ char *p; /* current data position */ int stale; /* count of stale leaves */ - struct xfs_name name; mp = bp->b_target->bt_mount; hdr = bp->b_addr; @@ -142,9 +141,8 @@ __xfs_dir3_data_check( addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, (xfs_dir2_data_aoff_t) ((char *)dep - (char *)hdr)); - name.name = dep->name; - name.len = dep->namelen; - hash = mp->m_dirnameops->hashname(&name); + hash = mp->m_dirnameops-> + hashname(dep->name, dep->namelen); for (i = 0; i < be32_to_cpu(btp->count); i++) { if (be32_to_cpu(lep[i].address) == addr && be32_to_cpu(lep[i].hashval) == hash) diff --git a/repair/phase6.c b/repair/phase6.c index f13069f..f374fd0 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -195,7 +195,7 @@ dir_hash_add( dup = 0; if (!junk) { - hash = mp->m_dirnameops->hashname(&xname); + hash = mp->m_dirnameops->hashname(name, namelen); byhash = DIR_HASH_FUNC(hashtab, hash); /* -- 1.7.12.4
WARNING: multiple messages have this Message-ID (diff)
From: Ben Myers <bpm@sgi.com> To: linux-fsdevel@vger.kernel.org Cc: tinguely@sgi.com, olaf@sgi.com, xfs@oss.sgi.com Subject: [PATCH 04/13] libxfs: change interface of xfs_nameops.normhash Date: Thu, 18 Sep 2014 15:35:55 -0500 [thread overview] Message-ID: <20140918203555.GR4482@sgi.com> (raw) In-Reply-To: <20140918203114.GN4482@sgi.com> From: Olaf Weber <olaf@sgi.com> With the introduction of the xfs_nameops.normhash callout, all uses of the hashname callout now occur in places where an xfs_name structure must be explicitly created just to match the parameter passing convention of this callout. Change the arguments to a const unsigned char * and int instead. Signed-off-by: Olaf Weber <olaf@sgi.com> --- db/check.c | 6 ++---- include/xfs_da_btree.h | 2 +- libxfs/xfs_da_btree.c | 9 +-------- libxfs/xfs_dir2.c | 10 ++++++---- libxfs/xfs_dir2_block.c | 5 +---- libxfs/xfs_dir2_data.c | 6 ++---- repair/phase6.c | 2 +- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/db/check.c b/db/check.c index 4fd9fd0..49359d7 100644 --- a/db/check.c +++ b/db/check.c @@ -2212,7 +2212,6 @@ process_data_dir_v2( int stale = 0; int tag_err; __be16 *tagp; - struct xfs_name xname; data = iocur_top->data; block = iocur_top->data; @@ -2323,9 +2322,8 @@ process_data_dir_v2( tag_err += be16_to_cpu(*tagp) != (char *)dep - (char *)data; addr = xfs_dir2_db_off_to_dataptr(mp, db, (char *)dep - (char *)data); - xname.name = dep->name; - xname.len = dep->namelen; - dir_hash_add(mp->m_dirnameops->hashname(&xname), addr); + dir_hash_add(mp->m_dirnameops->hashname(dep->name, + dep->namelen), addr); ptr += xfs_dir3_data_entsize(mp, dep->namelen); count++; lastfree = 0; diff --git a/include/xfs_da_btree.h b/include/xfs_da_btree.h index 06b50bf..9674bed 100644 --- a/include/xfs_da_btree.h +++ b/include/xfs_da_btree.h @@ -132,7 +132,7 @@ typedef struct xfs_da_state { * Name ops for directory and/or attr name operations */ struct xfs_nameops { - xfs_dahash_t (*hashname)(struct xfs_name *); + xfs_dahash_t (*hashname)(const unsigned char *, int); int (*normhash)(struct xfs_da_args *); enum xfs_dacmp (*compname)(struct xfs_da_args *, const unsigned char *, int); diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index eb97317..7be5eaf 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -1993,13 +1993,6 @@ xfs_da_compname( XFS_CMP_EXACT : XFS_CMP_DIFFERENT; } -static xfs_dahash_t -xfs_default_hashname( - struct xfs_name *name) -{ - return xfs_da_hashname(name->name, name->len); -} - STATIC int xfs_da_normhash( struct xfs_da_args *args) @@ -2009,7 +2002,7 @@ xfs_da_normhash( } const struct xfs_nameops xfs_default_nameops = { - .hashname = xfs_default_hashname, + .hashname = xfs_da_hashname, .normhash = xfs_da_normhash, .compname = xfs_da_compname }; diff --git a/libxfs/xfs_dir2.c b/libxfs/xfs_dir2.c index e52d082..1893931 100644 --- a/libxfs/xfs_dir2.c +++ b/libxfs/xfs_dir2.c @@ -43,13 +43,14 @@ const unsigned char xfs_mode_to_ftype[S_IFMT >> S_SHIFT] = { */ STATIC xfs_dahash_t xfs_ascii_ci_hashname( - struct xfs_name *name) + const unsigned char *name, + int len) { xfs_dahash_t hash; int i; - for (i = 0, hash = 0; i < name->len; i++) - hash = tolower(name->name[i]) ^ rol32(hash, 7); + for (i = 0, hash = 0; i < len; i++) + hash = tolower(name[i]) ^ rol32(hash, 7); return hash; } @@ -475,7 +476,8 @@ xfs_dir_canenter( args.name = name->name; args.namelen = name->len; args.filetype = name->type; - args.hashval = dp->i_mount->m_dirnameops->hashname(name); + args.hashval = dp->i_mount->m_dirnameops->hashname(name->name, + name->len); args.dp = dp; args.whichfork = XFS_DATA_FORK; args.trans = tp; diff --git a/libxfs/xfs_dir2_block.c b/libxfs/xfs_dir2_block.c index 2880431..1a8b5f5 100644 --- a/libxfs/xfs_dir2_block.c +++ b/libxfs/xfs_dir2_block.c @@ -1047,7 +1047,6 @@ xfs_dir2_sf_to_block( xfs_dir2_sf_hdr_t *sfp; /* shortform header */ __be16 *tagp; /* end of data entry */ xfs_trans_t *tp; /* transaction pointer */ - struct xfs_name name; struct xfs_ifork *ifp; trace_xfs_dir2_sf_to_block(args); @@ -1205,10 +1204,8 @@ xfs_dir2_sf_to_block( tagp = xfs_dir3_data_entry_tag_p(mp, dep); *tagp = cpu_to_be16((char *)dep - (char *)hdr); xfs_dir2_data_log_entry(tp, bp, dep); - name.name = sfep->name; - name.len = sfep->namelen; blp[2 + i].hashval = cpu_to_be32(mp->m_dirnameops-> - hashname(&name)); + hashname(sfep->name, sfep->namelen)); blp[2 + i].address = cpu_to_be32(xfs_dir2_byte_to_dataptr(mp, (char *)dep - (char *)hdr)); offset = (int)((char *)(tagp + 1) - (char *)hdr); diff --git a/libxfs/xfs_dir2_data.c b/libxfs/xfs_dir2_data.c index dc9df4d..9b3f750 100644 --- a/libxfs/xfs_dir2_data.c +++ b/libxfs/xfs_dir2_data.c @@ -46,7 +46,6 @@ __xfs_dir3_data_check( xfs_mount_t *mp; /* filesystem mount point */ char *p; /* current data position */ int stale; /* count of stale leaves */ - struct xfs_name name; mp = bp->b_target->bt_mount; hdr = bp->b_addr; @@ -142,9 +141,8 @@ __xfs_dir3_data_check( addr = xfs_dir2_db_off_to_dataptr(mp, mp->m_dirdatablk, (xfs_dir2_data_aoff_t) ((char *)dep - (char *)hdr)); - name.name = dep->name; - name.len = dep->namelen; - hash = mp->m_dirnameops->hashname(&name); + hash = mp->m_dirnameops-> + hashname(dep->name, dep->namelen); for (i = 0; i < be32_to_cpu(btp->count); i++) { if (be32_to_cpu(lep[i].address) == addr && be32_to_cpu(lep[i].hashval) == hash) diff --git a/repair/phase6.c b/repair/phase6.c index f13069f..f374fd0 100644 --- a/repair/phase6.c +++ b/repair/phase6.c @@ -195,7 +195,7 @@ dir_hash_add( dup = 0; if (!junk) { - hash = mp->m_dirnameops->hashname(&xname); + hash = mp->m_dirnameops->hashname(name, namelen); byhash = DIR_HASH_FUNC(hashtab, hash); /* -- 1.7.12.4 _______________________________________________ xfs mailing list xfs@oss.sgi.com http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-09-18 20:35 UTC|newest] Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-18 19:56 [RFC v2] Unicode/UTF-8 support for XFS Ben Myers 2014-09-18 20:08 ` [PATCH 01/10] xfs: return the first match during case-insensitive lookup Ben Myers 2014-09-18 20:09 ` [PATCH 02/10] xfs: rename XFS_CMP_CASE to XFS_CMP_MATCH Ben Myers 2014-09-18 20:09 ` [PATCH 03/13] libxfs: add xfs_nameops.normhash Ben Myers 2014-09-18 20:10 ` [PATCH 04/10] xfs: change interface of xfs_nameops.normhash Ben Myers 2014-09-18 20:10 ` Ben Myers 2014-09-18 20:11 ` [PATCH 05/10] xfs: add a superblock feature bit to indicate UTF-8 support Ben Myers 2014-09-18 20:13 ` [PATCH 03/10] xfs: add xfs_nameops.normhash Ben Myers 2014-09-18 20:14 ` [PATCH 06/10] xfs: add unicode character database files Ben Myers 2014-09-18 20:14 ` Ben Myers 2014-09-22 20:54 ` Dave Chinner 2014-09-22 20:54 ` Dave Chinner 2014-09-26 17:09 ` Christoph Hellwig 2014-09-18 20:15 ` [PATCH 07/10] xfs: add trie generator and supporting code for UTF-8 Ben Myers 2014-09-22 20:57 ` Dave Chinner 2014-09-22 20:57 ` Dave Chinner 2014-09-23 18:57 ` Ben Myers 2014-09-26 17:10 ` Christoph Hellwig 2014-09-18 20:16 ` [PATCH 08/10] xfs: add xfs_nameops for utf8 and utf8+casefold Ben Myers 2014-09-18 20:16 ` Ben Myers 2014-09-18 20:17 ` [PATCH 09/10] xfs: apply utf-8 normalization rules to user extended attribute names Ben Myers 2014-09-18 20:18 ` [PATCH 10/10] xfs: implement demand load of utf8norm.ko Ben Myers 2014-09-18 20:31 ` [PATCH 00/13] xfsprogs: Unicode/UTF-8 support for XFS Ben Myers 2014-09-18 20:33 ` [PATCH 01/13] libxfs: return the first match during case-insensitive lookup Ben Myers 2014-09-18 20:33 ` [PATCH 02/13] libxfs: rename XFS_CMP_CASE to XFS_CMP_MATCH Ben Myers 2014-09-18 20:34 ` [PATCH 03/13] libxfs: add xfs_nameops.normhash Ben Myers 2014-09-18 20:35 ` Ben Myers [this message] 2014-09-18 20:35 ` [PATCH 04/13] libxfs: change interface of xfs_nameops.normhash Ben Myers 2014-09-18 20:36 ` [PATCH 05/13] libxfs: add a superblock feature bit to indicate UTF-8 support Ben Myers 2014-09-18 20:37 ` [PATCH 06/13] xfsprogs: add unicode character database files Ben Myers 2014-09-18 20:38 ` [PATCH 07/13] libxfs: add trie generator and supporting code for UTF-8 Ben Myers 2014-09-18 20:38 ` [PATCH 08/13] libxfs: add xfs_nameops for utf8 and utf8+casefold Ben Myers 2014-09-18 20:39 ` [PATCH 09/13] libxfs: apply utf-8 normalization rules to user extended attribute names Ben Myers 2014-09-18 20:40 ` [PATCH 10/13] xfsprogs: add utf8 support to growfs Ben Myers 2014-09-18 20:41 ` [PATCH 11/13] xfsprogs: add utf8 support to mkfs.xfs Ben Myers 2014-09-18 20:42 ` [PATCH 12/13] xfsprogs: add utf8 support to xfs_repair Ben Myers 2014-09-18 20:42 ` Ben Myers 2014-09-18 20:43 ` [PATCH 13/13] xfsprogs: add a preliminary test for utf8 support Ben Myers 2014-09-19 16:06 ` [PATCH 07a/13] xfsprogs: add trie generator for UTF-8 Ben Myers 2014-09-23 18:34 ` Roger Willcocks 2014-09-24 23:11 ` Ben Myers 2014-09-19 16:07 ` [PATCH 07b/13] libxfs: add supporting code " Ben Myers 2014-09-18 21:10 ` [RFC v2] Unicode/UTF-8 support for XFS Ben Myers 2014-09-18 21:24 ` Zach Brown 2014-09-18 21:24 ` Zach Brown 2014-09-18 22:23 ` Ben Myers 2014-09-19 16:03 ` [PATCH 07a/10] xfs: add trie generator for UTF-8 Ben Myers 2014-09-19 16:04 ` [PATCH 07b/10] xfs: add supporting code " Ben Myers 2014-09-22 14:55 ` [RFC v2] Unicode/UTF-8 support for XFS Andi Kleen 2014-09-22 14:55 ` Andi Kleen 2014-09-22 18:41 ` Ben Myers 2014-09-22 19:29 ` Andi Kleen 2014-09-22 19:29 ` Andi Kleen 2014-09-23 16:13 ` Olaf Weber 2014-09-23 20:15 ` Andi Kleen 2014-09-23 20:45 ` Ben Myers 2014-09-23 20:45 ` Ben Myers 2014-09-24 11:07 ` Olaf Weber 2014-09-26 14:06 ` Olaf Weber 2014-09-23 13:01 ` Olaf Weber 2014-09-23 20:02 ` Andi Kleen 2014-09-22 22:26 ` Dave Chinner 2014-09-22 22:26 ` Dave Chinner 2014-09-24 13:21 ` Olaf Weber 2014-09-24 13:21 ` Olaf Weber 2014-09-24 23:10 ` Dave Chinner 2014-09-24 23:10 ` Dave Chinner 2014-09-25 13:33 ` Zuckerman, Boris 2014-09-26 14:50 ` Olaf Weber 2014-09-26 16:56 ` Christoph Hellwig 2014-09-26 16:56 ` Christoph Hellwig 2014-09-26 17:04 ` Jeremy Allison 2014-09-26 17:06 ` Christoph Hellwig 2014-09-26 17:13 ` Jeremy Allison 2014-09-26 17:13 ` Jeremy Allison 2014-09-26 19:37 ` Olaf Weber 2014-09-26 19:46 ` Jeremy Allison 2014-09-26 20:03 ` Olaf Weber 2014-09-29 20:16 ` J. Bruce Fields 2014-09-29 20:16 ` J. Bruce Fields 2014-09-29 11:06 ` Christoph Hellwig 2014-09-29 11:06 ` Christoph Hellwig 2014-09-26 17:30 ` Ben Myers -- strict thread matches above, loose matches on Subject: below -- 2014-09-11 20:37 [RFC] " Ben Myers 2014-09-11 20:55 ` [PATCH 04/13] libxfs: change interface of xfs_nameops.normhash Ben Myers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20140918203555.GR4482@sgi.com \ --to=bpm@sgi.com \ --cc=linux-fsdevel@vger.kernel.org \ --cc=olaf@sgi.com \ --cc=tinguely@sgi.com \ --cc=xfs@oss.sgi.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.