expfs.c (446279168e030fd0ed68e2bba336bef8bb3da352) | expfs.c (25885a35a72007cf28ec5f9ba7169c5c798f7167) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Neil Brown 2002 4 * Copyright (C) Christoph Hellwig 2007 5 * 6 * This file contains the code mapping from inodes to NFS file handles, 7 * and for mapping back from file handles to dentries. 8 * --- 234 unchanged lines hidden (view full) --- 243 int found; /* inode matched? */ 244 int sequence; /* sequence counter */ 245}; 246 247/* 248 * A rather strange filldir function to capture 249 * the name matching the specified inode number. 250 */ | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Copyright (C) Neil Brown 2002 4 * Copyright (C) Christoph Hellwig 2007 5 * 6 * This file contains the code mapping from inodes to NFS file handles, 7 * and for mapping back from file handles to dentries. 8 * --- 234 unchanged lines hidden (view full) --- 243 int found; /* inode matched? */ 244 int sequence; /* sequence counter */ 245}; 246 247/* 248 * A rather strange filldir function to capture 249 * the name matching the specified inode number. 250 */ |
251static int filldir_one(struct dir_context *ctx, const char *name, int len, | 251static bool filldir_one(struct dir_context *ctx, const char *name, int len, |
252 loff_t pos, u64 ino, unsigned int d_type) 253{ 254 struct getdents_callback *buf = 255 container_of(ctx, struct getdents_callback, ctx); | 252 loff_t pos, u64 ino, unsigned int d_type) 253{ 254 struct getdents_callback *buf = 255 container_of(ctx, struct getdents_callback, ctx); |
256 int result = 0; | |
257 258 buf->sequence++; 259 if (buf->ino == ino && len <= NAME_MAX) { 260 memcpy(buf->name, name, len); 261 buf->name[len] = '\0'; 262 buf->found = 1; | 256 257 buf->sequence++; 258 if (buf->ino == ino && len <= NAME_MAX) { 259 memcpy(buf->name, name, len); 260 buf->name[len] = '\0'; 261 buf->found = 1; |
263 result = -1; | 262 return false; // no more |
264 } | 263 } |
265 return result; | 264 return true; |
266} 267 268/** 269 * get_name - default export_operations->get_name function 270 * @path: the directory in which to find a name 271 * @name: a pointer to a %NAME_MAX+1 char buffer to store the name 272 * @child: the dentry for the child directory. 273 * --- 314 unchanged lines hidden --- | 265} 266 267/** 268 * get_name - default export_operations->get_name function 269 * @path: the directory in which to find a name 270 * @name: a pointer to a %NAME_MAX+1 char buffer to store the name 271 * @child: the dentry for the child directory. 272 * --- 314 unchanged lines hidden --- |