expfs.c (b52878275ce54b5d3a654ed24dfb169c1c501998) | expfs.c (304e9c83e80d5cbe20ab64ffa1fac9fc51d30bc9) |
---|---|
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 * --- 367 unchanged lines hidden (view full) --- 376 fid->i32.parent_gen = parent->i_generation; 377 len = 4; 378 type = FILEID_INO32_GEN_PARENT; 379 } 380 *max_len = len; 381 return type; 382} 383 | 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 * --- 367 unchanged lines hidden (view full) --- 376 fid->i32.parent_gen = parent->i_generation; 377 len = 4; 378 type = FILEID_INO32_GEN_PARENT; 379 } 380 *max_len = len; 381 return type; 382} 383 |
384/** 385 * exportfs_encode_inode_fh - encode a file handle from inode 386 * @inode: the object to encode 387 * @fid: where to store the file handle fragment 388 * @max_len: maximum length to store there 389 * @flags: properties of the requested file handle 390 * 391 * Returns an enum fid_type or a negative errno. 392 */ |
|
384int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, | 393int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, |
385 int *max_len, struct inode *parent) | 394 int *max_len, struct inode *parent, int flags) |
386{ 387 const struct export_operations *nop = inode->i_sb->s_export_op; 388 | 395{ 396 const struct export_operations *nop = inode->i_sb->s_export_op; 397 |
398 /* 399 * If a decodeable file handle was requested, we need to make sure that 400 * filesystem can decode file handles. 401 */ 402 if (nop && !(flags & EXPORT_FH_FID) && !nop->fh_to_dentry) 403 return -EOPNOTSUPP; 404 |
|
389 if (nop && nop->encode_fh) 390 return nop->encode_fh(inode, fid->raw, max_len, parent); 391 392 return export_encode_fh(inode, fid, max_len, parent); 393} 394EXPORT_SYMBOL_GPL(exportfs_encode_inode_fh); 395 396/** --- 16 unchanged lines hidden (view full) --- 413 p = dget_parent(dentry); 414 /* 415 * note that while p might've ceased to be our parent already, 416 * it's still pinned by and still positive. 417 */ 418 parent = p->d_inode; 419 } 420 | 405 if (nop && nop->encode_fh) 406 return nop->encode_fh(inode, fid->raw, max_len, parent); 407 408 return export_encode_fh(inode, fid, max_len, parent); 409} 410EXPORT_SYMBOL_GPL(exportfs_encode_inode_fh); 411 412/** --- 16 unchanged lines hidden (view full) --- 429 p = dget_parent(dentry); 430 /* 431 * note that while p might've ceased to be our parent already, 432 * it's still pinned by and still positive. 433 */ 434 parent = p->d_inode; 435 } 436 |
421 error = exportfs_encode_inode_fh(inode, fid, max_len, parent); | 437 error = exportfs_encode_inode_fh(inode, fid, max_len, parent, flags); |
422 dput(p); 423 424 return error; 425} 426EXPORT_SYMBOL_GPL(exportfs_encode_fh); 427 428struct dentry * 429exportfs_decode_fh_raw(struct vfsmount *mnt, struct fid *fid, int fh_len, --- 166 unchanged lines hidden --- | 438 dput(p); 439 440 return error; 441} 442EXPORT_SYMBOL_GPL(exportfs_encode_fh); 443 444struct dentry * 445exportfs_decode_fh_raw(struct vfsmount *mnt, struct fid *fid, int fh_len, --- 166 unchanged lines hidden --- |