Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
aufs
aufs-factor-out-__lookup_one_len
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File aufs-factor-out-__lookup_one_len of Package aufs
From: Jeff Mahoney <jeffm@suse.com> Subject: aufs: Factor out __lookup_one_len The existing code acknowledges that it's just open coding __lookup_one_len, so why not just copy the function entirely and call it. If the code is ever merged with mainline, it will be an obvious thing to rename and export rather than having two copies of it. Signed-off-by: Jeff Mahoney <jeffm@suse.com> --- fs/aufs25/br_nfs.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) --- a/fs/aufs25/br_nfs.c +++ b/fs/aufs25/br_nfs.c @@ -231,6 +231,28 @@ int au_hin_after_reval(struct nameidata return err; } +static int __lookup_one_len(const char *name, struct qstr *this, + struct dentry *base, int len) +{ + unsigned long hash; + unsigned int c; + + this->name = name; + this->len = len; + if (!len) + return -EACCES; + + hash = init_name_hash(); + while (len--) { + c = *(const unsigned char *)name++; + if (c == '/' || c == '\0') + return -EACCES; + hash = partial_name_hash(c, hash); + } + this->hash = end_name_hash(hash); + return 0; +} + #ifdef CONFIG_AUFS_DLGT struct au_lookup_hash_args { struct dentry **errp; @@ -285,32 +307,17 @@ struct dentry *au_lkup_hash(const char * int len, struct au_ndx *ndx) { struct dentry *dentry; - char *p; - unsigned long hash; struct qstr this; - unsigned int c; struct nameidata tmp_nd, *ndo; int err; LKTRTrace("%.*s/%.*s\n", AuDLNPair(parent), len, name); - /* todo: export and call __lookup_one_len() in fs/namei.c? */ - dentry = ERR_PTR(-EACCES); - this.name = name; - this.len = len; - if (unlikely(!len)) + err = __lookup_one_len(name, &this, parent, len); + dentry = ERR_PTR(err); + if (err) goto out; - p = (void *)name; - hash = init_name_hash(); - while (len--) { - c = *p++; - if (unlikely(c == '/' || c == '\0')) - goto out; - hash = partial_name_hash(c, hash); - } - this.hash = end_name_hash(hash); - ndo = ndx->nd; if (ndo) { tmp_nd = *ndo;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor