Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+9 -4
+9 -4
fs/fuse/readdir.c
··· 26 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 36 static int parse_dirfile(char *buf, size_t nbytes, struct file *file, 30 37 struct dir_context *ctx) 31 38 { ··· 46 39 if (memchr(dirent->name, '/', dirent->namelen) != NULL) 47 40 return -EIO; 48 41 49 - if (!dir_emit(ctx, dirent->name, dirent->namelen, 50 - dirent->ino, dirent->type)) 42 + if (!fuse_emit(file, ctx, dirent)) 51 43 break; 52 44 53 45 buf += reclen; ··· 189 183 we need to send a FORGET for each of those 190 184 which we did not link. 191 185 */ 192 - over = !dir_emit(ctx, dirent->name, dirent->namelen, 193 - dirent->ino, dirent->type); 186 + over = !fuse_emit(file, ctx, dirent); 194 187 if (!over) 195 188 ctx->pos = dirent->off; 196 189 }