> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/vfs_fhtovp.9.md).

# VFS\_FHTOVP.9

`VFS_FHTOVP` — 将 NFS 文件句柄转换为 vnode

## 名称

`VFS_FHTOVP`

## 概要

```c
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/vnode.h>

int
VFS_FHTOVP(struct mount *mp, struct fid *fhp, int flags, struct vnode **vpp)
```

## 描述

`VFS_FHTOVP` 宏由 NFS 服务器用来将 NFS 文件句柄转换为 vnode。

它所需的参数为：

**`mp`** 文件系统。

**`fhp`** 要转换的文件句柄。

**`flags`** 传递给 [vget(9)](/man/man9/vget.9.md) 的附加锁定标志。文件系统可以忽略 `flags` 并改用 `LK_EXCLUSIVE`。

**`vpp`** 返回新的已锁定 vnode 的返回参数。

文件句柄的内容由文件系统定义，不被系统的任何其他部分检查。它应包含足够的信息以唯一标识文件系统内的文件，并能注意到文件何时已被删除以及文件系统资源何时已被重用于新文件。例如，UFS 文件系统在其文件句柄中存储 inode 号和 inode 生成计数器。

调用 `VFS_FHTOVP` 之前通常应先调用 [VFS\_CHECKEXP(9)](/man/man9/vfs_checkexp.9.md) 来检查客户端是否可访问该文件。

## 返回值

该文件的已锁定 vnode 将通过 `*vpp` 返回。

## 参见

[VFS(9)](/man/man9/vfs.9.md), [VFS\_CHECKEXP(9)](/man/man9/vfs_checkexp.9.md), [vnode(9)](/man/man9/vnode.9.md), [VOP\_VPTOFH(9)](/man/man9/vop_vptofh.9.md)

## 作者

本手册页由 Doug Rabson 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/vfs_fhtovp.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
