Commit 6a96ba54418be740303765c0f52be028573cb99a
1 parent
fe2d35ff0d
Exists in
master
and in
20 other branches
kill __lookup_one_len()
only one caller left Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 15 additions and 26 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -1759,28 +1759,6 @@ |
1759 | 1759 | return __lookup_hash(&nd->last, nd->path.dentry, nd); |
1760 | 1760 | } |
1761 | 1761 | |
1762 | -static int __lookup_one_len(const char *name, struct qstr *this, | |
1763 | - struct dentry *base, int len) | |
1764 | -{ | |
1765 | - unsigned long hash; | |
1766 | - unsigned int c; | |
1767 | - | |
1768 | - this->name = name; | |
1769 | - this->len = len; | |
1770 | - if (!len) | |
1771 | - return -EACCES; | |
1772 | - | |
1773 | - hash = init_name_hash(); | |
1774 | - while (len--) { | |
1775 | - c = *(const unsigned char *)name++; | |
1776 | - if (c == '/' || c == '\0') | |
1777 | - return -EACCES; | |
1778 | - hash = partial_name_hash(c, hash); | |
1779 | - } | |
1780 | - this->hash = end_name_hash(hash); | |
1781 | - return 0; | |
1782 | -} | |
1783 | - | |
1784 | 1762 | /** |
1785 | 1763 | * lookup_one_len - filesystem helper to lookup single pathname component |
1786 | 1764 | * @name: pathname component to lookup |
1787 | 1765 | |
1788 | 1766 | |
... | ... | @@ -1794,14 +1772,25 @@ |
1794 | 1772 | */ |
1795 | 1773 | struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) |
1796 | 1774 | { |
1797 | - int err; | |
1798 | 1775 | struct qstr this; |
1776 | + unsigned long hash; | |
1777 | + unsigned int c; | |
1799 | 1778 | |
1800 | 1779 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); |
1801 | 1780 | |
1802 | - err = __lookup_one_len(name, &this, base, len); | |
1803 | - if (err) | |
1804 | - return ERR_PTR(err); | |
1781 | + this.name = name; | |
1782 | + this.len = len; | |
1783 | + if (!len) | |
1784 | + return ERR_PTR(-EACCES); | |
1785 | + | |
1786 | + hash = init_name_hash(); | |
1787 | + while (len--) { | |
1788 | + c = *(const unsigned char *)name++; | |
1789 | + if (c == '/' || c == '\0') | |
1790 | + return ERR_PTR(-EACCES); | |
1791 | + hash = partial_name_hash(c, hash); | |
1792 | + } | |
1793 | + this.hash = end_name_hash(hash); | |
1805 | 1794 | |
1806 | 1795 | return __lookup_hash(&this, base, NULL); |
1807 | 1796 | } |