Lines Matching +full:encode +full:- +full:only
1 // SPDX-License-Identifier: GPL-2.0-only
30 const struct export_operations *nop = dir->d_sb->s_export_op; in exportfs_get_name()
33 if (nop->get_name) in exportfs_get_name()
34 return nop->get_name(dir, name, child); in exportfs_get_name()
53 inode = result->d_inode; in find_acceptable_alias()
54 spin_lock(&inode->i_lock); in find_acceptable_alias()
55 hlist_for_each_entry(dentry, &inode->i_dentry, d_u.d_alias) { in find_acceptable_alias()
57 spin_unlock(&inode->i_lock); in find_acceptable_alias()
64 spin_lock(&inode->i_lock); in find_acceptable_alias()
67 spin_unlock(&inode->i_lock); in find_acceptable_alias()
77 while (dentry->d_flags & DCACHE_DISCONNECTED) { in dentry_connected()
94 while (dentry->d_flags & DCACHE_DISCONNECTED) { in clear_disconnected()
99 spin_lock(&dentry->d_lock); in clear_disconnected()
100 dentry->d_flags &= ~DCACHE_DISCONNECTED; in clear_disconnected()
101 spin_unlock(&dentry->d_lock); in clear_disconnected()
128 parent = ERR_PTR(-EACCES); in reconnect_one()
129 inode_lock(dentry->d_inode); in reconnect_one()
130 if (mnt->mnt_sb->s_export_op->get_parent) in reconnect_one()
131 parent = mnt->mnt_sb->s_export_op->get_parent(dentry); in reconnect_one()
132 inode_unlock(dentry->d_inode); in reconnect_one()
136 dentry->d_inode->i_ino, PTR_ERR(parent)); in reconnect_one()
141 dentry->d_inode->i_ino, parent->d_inode->i_ino); in reconnect_one()
143 if (err == -ENOENT) in reconnect_one()
157 * great, since it could've only been renamed if it in reconnect_one()
166 err = -ESTALE; in reconnect_one()
187 * double check that this worked and return -ESTALE if not: in reconnect_one()
190 return ERR_PTR(-ESTALE); in reconnect_one()
198 * target_dir, and target_dir->d_parent->...->d_parent will reach the
218 while (dentry->d_flags & DCACHE_DISCONNECTED) { in reconnect_path()
219 BUG_ON(dentry == mnt->mnt_sb->s_root); in reconnect_path()
257 buf->sequence++; in filldir_one()
258 if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) { in filldir_one()
259 memcpy(buf->name, name, len); in filldir_one()
260 buf->name[len] = '\0'; in filldir_one()
261 buf->found = 1; in filldir_one()
268 * get_name - default export_operations->get_name function
279 struct inode *dir = path->dentry->d_inode; in get_name()
284 .mnt = path->mnt, in get_name()
292 error = -ENOTDIR; in get_name()
293 if (!dir || !S_ISDIR(dir->i_mode)) in get_name()
295 error = -EINVAL; in get_name()
296 if (!dir->i_fop) in get_name()
299 * inode->i_ino is unsigned long, kstat->ino is u64, so the in get_name()
300 * former would be insufficient on 32-bit hosts when the in get_name()
301 * filesystem supports 64-bit inode numbers. So we need to in get_name()
302 * actually call ->getattr, not just read i_ino: in get_name()
317 error = -EINVAL; in get_name()
318 if (!file->f_op->iterate_shared) in get_name()
334 error = -ENOENT; in get_name()
348 * exportfs_encode_ino64_fid - encode non-decodeable 64bit ino file id
349 * @inode: the object to encode
353 * This generic function is used to encode a non-decodeable file id for
364 fid->i64.ino = inode->i_ino; in exportfs_encode_ino64_fid()
365 fid->i64.gen = inode->i_generation; in exportfs_encode_ino64_fid()
372 * exportfs_encode_inode_fh - encode a file handle from inode
373 * @inode: the object to encode
384 const struct export_operations *nop = inode->i_sb->s_export_op; in exportfs_encode_inode_fh()
387 return -EOPNOTSUPP; in exportfs_encode_inode_fh()
392 return nop->encode_fh(inode, fid->raw, max_len, parent); in exportfs_encode_inode_fh()
397 * exportfs_encode_fh - encode a file handle from dentry
398 * @dentry: the object to encode
410 struct inode *inode = dentry->d_inode, *parent = NULL; in exportfs_encode_fh()
412 if ((flags & EXPORT_FH_CONNECTABLE) && !S_ISDIR(inode->i_mode)) { in exportfs_encode_fh()
418 parent = p->d_inode; in exportfs_encode_fh()
434 const struct export_operations *nop = mnt->mnt_sb->s_export_op; in exportfs_decode_fh_raw()
443 return ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
444 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); in exportfs_decode_fh_raw()
449 err = -ENOTDIR; in exportfs_decode_fh_raw()
466 * On the positive side there is only one dentry for each in exportfs_decode_fh_raw()
471 if (result->d_flags & DCACHE_DISCONNECTED) { in exportfs_decode_fh_raw()
478 err = -EACCES; in exportfs_decode_fh_raw()
506 err = -ESTALE; in exportfs_decode_fh_raw()
507 if (!nop->fh_to_parent) in exportfs_decode_fh_raw()
510 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, in exportfs_decode_fh_raw()
530 * Now that we've got both a well-connected parent and a in exportfs_decode_fh_raw()
540 inode_lock(target_dir->d_inode); in exportfs_decode_fh_raw()
544 if (unlikely(nresult->d_inode != result->d_inode)) { in exportfs_decode_fh_raw()
546 nresult = ERR_PTR(-ESTALE); in exportfs_decode_fh_raw()
549 inode_unlock(target_dir->d_inode); in exportfs_decode_fh_raw()
569 err = -EACCES; in exportfs_decode_fh_raw()
592 if (ret == ERR_PTR(-ENOMEM)) in exportfs_decode_fh()
594 return ERR_PTR(-ESTALE); in exportfs_decode_fh()