diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2018-09-28 10:43:23 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-09-28 10:43:23 -0400 |
commit | 18172b10b674a7cd5340b2dd70202ce6622400bd (patch) | |
tree | 705f3ad3dd861b6e3610d91f487f0fcffb96eeb0 /fs/fuse | |
parent | 6433b8998a21dc597002731c4ceb4144e856edc4 (diff) |
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>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/readdir.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index 3e100e00e21e..65336c93c1f4 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c | |||
@@ -26,6 +26,13 @@ static bool fuse_use_readdirplus(struct inode *dir, struct dir_context *ctx) | |||
26 | return false; | 26 | return false; |
27 | } | 27 | } |
28 | 28 | ||
29 | static bool fuse_emit(struct file *file, struct dir_context *ctx, | ||
30 | struct fuse_dirent *dirent) | ||
31 | { | ||
32 | return dir_emit(ctx, dirent->name, dirent->namelen, dirent->ino, | ||
33 | dirent->type); | ||
34 | } | ||
35 | |||
29 | static int parse_dirfile(char *buf, size_t nbytes, struct file *file, | 36 | static int parse_dirfile(char *buf, size_t nbytes, struct file *file, |
30 | struct dir_context *ctx) | 37 | struct dir_context *ctx) |
31 | { | 38 | { |
@@ -39,8 +46,7 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file, | |||
39 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) | 46 | if (memchr(dirent->name, '/', dirent->namelen) != NULL) |
40 | return -EIO; | 47 | return -EIO; |
41 | 48 | ||
42 | if (!dir_emit(ctx, dirent->name, dirent->namelen, | 49 | if (!fuse_emit(file, ctx, dirent)) |
43 | dirent->ino, dirent->type)) | ||
44 | break; | 50 | break; |
45 | 51 | ||
46 | buf += reclen; | 52 | buf += reclen; |
@@ -183,8 +189,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file, | |||
183 | we need to send a FORGET for each of those | 189 | we need to send a FORGET for each of those |
184 | which we did not link. | 190 | which we did not link. |
185 | */ | 191 | */ |
186 | over = !dir_emit(ctx, dirent->name, dirent->namelen, | 192 | over = !fuse_emit(file, ctx, dirent); |
187 | dirent->ino, dirent->type); | ||
188 | if (!over) | 193 | if (!over) |
189 | ctx->pos = dirent->off; | 194 | ctx->pos = dirent->off; |
190 | } | 195 | } |