bfs_find_entry: pass name/len as qstr pointer

all callers feed something->name/something->len anyway

Cc: "Tigran A. Aivazian" <aivazian.tigran@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2018-04-30 19:10:34 -04:00
Родитель a596a23b9a
Коммит 33ebdebece
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -24,7 +24,7 @@
static int bfs_add_entry(struct inode *dir, const unsigned char *name, static int bfs_add_entry(struct inode *dir, const unsigned char *name,
int namelen, int ino); int namelen, int ino);
static struct buffer_head *bfs_find_entry(struct inode *dir, static struct buffer_head *bfs_find_entry(struct inode *dir,
const unsigned char *name, int namelen, const struct qstr *child,
struct bfs_dirent **res_dir); struct bfs_dirent **res_dir);
static int bfs_readdir(struct file *f, struct dir_context *ctx) static int bfs_readdir(struct file *f, struct dir_context *ctx)
@ -136,7 +136,7 @@ static struct dentry *bfs_lookup(struct inode *dir, struct dentry *dentry,
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
mutex_lock(&info->bfs_lock); mutex_lock(&info->bfs_lock);
bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); bh = bfs_find_entry(dir, &dentry->d_name, &de);
if (bh) { if (bh) {
unsigned long ino = (unsigned long)le16_to_cpu(de->ino); unsigned long ino = (unsigned long)le16_to_cpu(de->ino);
brelse(bh); brelse(bh);
@ -178,7 +178,7 @@ static int bfs_unlink(struct inode *dir, struct dentry *dentry)
struct bfs_sb_info *info = BFS_SB(inode->i_sb); struct bfs_sb_info *info = BFS_SB(inode->i_sb);
mutex_lock(&info->bfs_lock); mutex_lock(&info->bfs_lock);
bh = bfs_find_entry(dir, dentry->d_name.name, dentry->d_name.len, &de); bh = bfs_find_entry(dir, &dentry->d_name, &de);
if (!bh || (le16_to_cpu(de->ino) != inode->i_ino)) if (!bh || (le16_to_cpu(de->ino) != inode->i_ino))
goto out_brelse; goto out_brelse;
@ -223,18 +223,14 @@ static int bfs_rename(struct inode *old_dir, struct dentry *old_dentry,
info = BFS_SB(old_inode->i_sb); info = BFS_SB(old_inode->i_sb);
mutex_lock(&info->bfs_lock); mutex_lock(&info->bfs_lock);
old_bh = bfs_find_entry(old_dir, old_bh = bfs_find_entry(old_dir, &old_dentry->d_name, &old_de);
old_dentry->d_name.name,
old_dentry->d_name.len, &old_de);
if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino)) if (!old_bh || (le16_to_cpu(old_de->ino) != old_inode->i_ino))
goto end_rename; goto end_rename;
error = -EPERM; error = -EPERM;
new_inode = d_inode(new_dentry); new_inode = d_inode(new_dentry);
new_bh = bfs_find_entry(new_dir, new_bh = bfs_find_entry(new_dir, &new_dentry->d_name, &new_de);
new_dentry->d_name.name,
new_dentry->d_name.len, &new_de);
if (new_bh && !new_inode) { if (new_bh && !new_inode) {
brelse(new_bh); brelse(new_bh);
@ -327,12 +323,14 @@ static inline int bfs_namecmp(int len, const unsigned char *name,
} }
static struct buffer_head *bfs_find_entry(struct inode *dir, static struct buffer_head *bfs_find_entry(struct inode *dir,
const unsigned char *name, int namelen, const struct qstr *child,
struct bfs_dirent **res_dir) struct bfs_dirent **res_dir)
{ {
unsigned long block = 0, offset = 0; unsigned long block = 0, offset = 0;
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct bfs_dirent *de; struct bfs_dirent *de;
const unsigned char *name = child->name;
int namelen = child->len;
*res_dir = NULL; *res_dir = NULL;
if (namelen > BFS_NAMELEN) if (namelen > BFS_NAMELEN)