aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_da_btree.h
diff options
context:
space:
mode:
authorBarry Naujok <bnaujok@sgi.com>2008-05-21 02:41:01 -0400
committerNiv Sardi <xaiki@debian.org>2008-07-28 02:58:36 -0400
commit5163f95a08cbf058ae16452c2242c5600fedc32e (patch)
tree5d6b905f7031144a62fb1fa17ba3106d99268003 /fs/xfs/xfs_da_btree.h
parent68f34d5107dbace3d14a1c2f060fc8941894879c (diff)
[XFS] Name operation vector for hash and compare
Adds two pieces of functionality for the basis of case-insensitive support in XFS: 1. A comparison result enumerated type: xfs_dacmp. It represents an exact match, case-insensitive match or no match at all. This patch only implements different and exact results. 2. xfs_nameops vector for specifying how to perform the hash generation of filenames and comparision methods. In this patch the hash vector points to the existing xfs_da_hashname function and the comparison method does a length compare, and if the same, does a memcmp and return the xfs_dacmp result. All filename functions that use the hash (create, lookup remove, rename, etc) now use the xfs_nameops.hashname function and all directory lookup functions also use the xfs_nameops.compname function. The lookup functions also handle case-insensitive results even though the default comparison function cannot return that. And important aspect of the lookup functions is that an exact match always has precedence over a case-insensitive. So while a case-insensitive match is found, we have to keep looking just in case there is an exact match. In the meantime, the info for the first case-insensitive match is retained if no exact match is found. SGI-PV: 981519 SGI-Modid: xfs-linux-melb:xfs-kern:31205a Signed-off-by: Barry Naujok <bnaujok@sgi.com> Signed-off-by: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'fs/xfs/xfs_da_btree.h')
-rw-r--r--fs/xfs/xfs_da_btree.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h
index 7facf86f74f9..e64c6924996f 100644
--- a/fs/xfs/xfs_da_btree.h
+++ b/fs/xfs/xfs_da_btree.h
@@ -99,6 +99,15 @@ typedef struct xfs_da_node_entry xfs_da_node_entry_t;
99 *========================================================================*/ 99 *========================================================================*/
100 100
101/* 101/*
102 * Search comparison results
103 */
104enum xfs_dacmp {
105 XFS_CMP_DIFFERENT, /* names are completely different */
106 XFS_CMP_EXACT, /* names are exactly the same */
107 XFS_CMP_CASE /* names are same but differ in case */
108};
109
110/*
102 * Structure to ease passing around component names. 111 * Structure to ease passing around component names.
103 */ 112 */
104typedef struct xfs_da_args { 113typedef struct xfs_da_args {
@@ -127,6 +136,7 @@ typedef struct xfs_da_args {
127 unsigned char rename; /* T/F: this is an atomic rename op */ 136 unsigned char rename; /* T/F: this is an atomic rename op */
128 unsigned char addname; /* T/F: this is an add operation */ 137 unsigned char addname; /* T/F: this is an add operation */
129 unsigned char oknoent; /* T/F: ok to return ENOENT, else die */ 138 unsigned char oknoent; /* T/F: ok to return ENOENT, else die */
139 enum xfs_dacmp cmpresult; /* name compare result for lookups */
130} xfs_da_args_t; 140} xfs_da_args_t;
131 141
132/* 142/*
@@ -201,6 +211,14 @@ typedef struct xfs_da_state {
201 (uint)(XFS_DA_LOGOFF(BASE, ADDR)), \ 211 (uint)(XFS_DA_LOGOFF(BASE, ADDR)), \
202 (uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1) 212 (uint)(XFS_DA_LOGOFF(BASE, ADDR)+(SIZE)-1)
203 213
214/*
215 * Name ops for directory and/or attr name operations
216 */
217struct xfs_nameops {
218 xfs_dahash_t (*hashname)(struct xfs_name *);
219 enum xfs_dacmp (*compname)(struct xfs_da_args *, const char *, int);
220};
221
204 222
205#ifdef __KERNEL__ 223#ifdef __KERNEL__
206/*======================================================================== 224/*========================================================================
@@ -249,6 +267,10 @@ int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
249 xfs_dabuf_t *dead_buf); 267 xfs_dabuf_t *dead_buf);
250 268
251uint xfs_da_hashname(const uchar_t *name_string, int name_length); 269uint xfs_da_hashname(const uchar_t *name_string, int name_length);
270enum xfs_dacmp xfs_da_compname(struct xfs_da_args *args,
271 const char *name, int len);
272
273
252xfs_da_state_t *xfs_da_state_alloc(void); 274xfs_da_state_t *xfs_da_state_alloc(void);
253void xfs_da_state_free(xfs_da_state_t *state); 275void xfs_da_state_free(xfs_da_state_t *state);
254 276