> 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/vn_isdisk.9.md).

# vn\_isdisk.9

`vn_isdisk` — 检查 vnode 是否表示磁盘

## 名称

`vn_isdisk`

## 概要

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

bool
vn_isdisk(struct vnode *vp)

bool
vn_isdisk_error(struct vnode *vp, int *errp)
```

## 描述

`vn_isdisk` 和 `vn_isdisk_error` 函数检查 `vp` 是否表示磁盘。要使 `vp` 成为磁盘，它必须是字符设备，`v_rdev` 必须有效，且 `cdevsw` 条目的 `flags` 必须设置了 `D_DISK`。

参数如下：

**`vp`** 要检查的 vnode。

**`errp`** 用于在调用失败时存储错误号的整数指针。

## 返回值

如果 vnode 表示磁盘，返回 true；否则返回 false 且 `errp` 将包含错误号。

## 作者

本手册页由 Chad David <davidc@acns.ab.ca> 编写。


---

# 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/vn_isdisk.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.
