mirror of https://gitee.com/openkylin/linux.git
fuse: extract fuse_emit() helper
Prepare for cache filling by introducing a helper for emitting a single directory entry. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
6433b8998a
commit
18172b10b6
|
@ -26,6 +26,13 @@ static bool fuse_use_readdirplus(struct inode *dir, struct dir_context *ctx)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool fuse_emit(struct file *file, struct dir_context *ctx,
|
||||||
|
struct fuse_dirent *dirent)
|
||||||
|
{
|
||||||
|
return dir_emit(ctx, dirent->name, dirent->namelen, dirent->ino,
|
||||||
|
dirent->type);
|
||||||
|
}
|
||||||
|
|
||||||
static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
|
static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
|
||||||
struct dir_context *ctx)
|
struct dir_context *ctx)
|
||||||
{
|
{
|
||||||
|
@ -39,8 +46,7 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
|
||||||
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
|
if (memchr(dirent->name, '/', dirent->namelen) != NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if (!dir_emit(ctx, dirent->name, dirent->namelen,
|
if (!fuse_emit(file, ctx, dirent))
|
||||||
dirent->ino, dirent->type))
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
buf += reclen;
|
buf += reclen;
|
||||||
|
@ -183,8 +189,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
|
||||||
we need to send a FORGET for each of those
|
we need to send a FORGET for each of those
|
||||||
which we did not link.
|
which we did not link.
|
||||||
*/
|
*/
|
||||||
over = !dir_emit(ctx, dirent->name, dirent->namelen,
|
over = !fuse_emit(file, ctx, dirent);
|
||||||
dirent->ino, dirent->type);
|
|
||||||
if (!over)
|
if (!over)
|
||||||
ctx->pos = dirent->off;
|
ctx->pos = dirent->off;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue