---
name: "libnvme_get_host-libnvme3"
section: "2"
platform: "linux"
package: "nvme-cli"
version: "3.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libnvme_get_host-libnvme3"
---

# libnvme\_get\_host-libnvme3(2)

Returns a host object

## NAME

libnvme\_get\_host - Returns a host object

## SYNOPSIS

**int libnvme\_get\_host** **(struct libnvme\_global\_ctx \*ctx** *,* **const char \*hostnqn** *,* **const char \*hostid** *,* **struct libnvme\_host \*\*h** *);*

## ARGUMENTS

- ctx

  struct libnvme\_global\_ctx object

- hostnqn

  Host NQN (optional)

- hostid

  Host ID (optional)

- h

  *struct libnvme\_host* object to return

## DESCRIPTION

Returns a host object based on the hostnqn/hostid values or the default if hostnqn/hostid are NULL.

## RETURN

0 on success, negative error code otherwise.
