Пример #1
0
static void
pci_iov_enumerate_vfs(struct pci_devinfo *dinfo, const nvlist_t *config,
    uint16_t first_rid, uint16_t rid_stride)
{
	char device_name[VF_MAX_NAME];
	const nvlist_t *device, *driver_config, *iov_config;
	device_t bus, dev, vf;
	struct pcicfg_iov *iov;
	struct pci_devinfo *vfinfo;
	size_t size;
	int i, error;
	uint16_t vid, did, next_rid;

	iov = dinfo->cfg.iov;
	dev = dinfo->cfg.dev;
	bus = device_get_parent(dev);
	size = dinfo->cfg.devinfo_size;
	next_rid = first_rid;
	vid = pci_get_vendor(dev);
	did = IOV_READ(dinfo, PCIR_SRIOV_VF_DID, 2);

	for (i = 0; i < iov->iov_num_vfs; i++, next_rid += rid_stride) {
		snprintf(device_name, sizeof(device_name), VF_PREFIX"%d", i);
		device = nvlist_get_nvlist(config, device_name);
		iov_config = nvlist_get_nvlist(device, IOV_CONFIG_NAME);
		driver_config = nvlist_get_nvlist(device, DRIVER_CONFIG_NAME);

		vf = PCI_CREATE_IOV_CHILD(bus, dev, next_rid, vid, did);
		if (vf == NULL)
			break;

		/*
		 * If we are creating passthrough devices then force the ppt
		 * driver to attach to prevent a VF driver from claiming the
		 * VFs.
		 */
		if (nvlist_get_bool(iov_config, "passthrough"))
			device_set_devclass_fixed(vf, "ppt");

		vfinfo = device_get_ivars(vf);

		vfinfo->cfg.iov = iov;
		vfinfo->cfg.vf.index = i;

		pci_iov_add_bars(iov, vfinfo);

		error = PCI_IOV_ADD_VF(dev, i, driver_config);
		if (error != 0) {
			device_printf(dev, "Failed to add VF %d\n", i);
			pci_delete_child(bus, vf);
		}
	}

	bus_generic_attach(bus);
}
Пример #2
0
static int
pwd_setpassent(const nvlist_t *limits, const nvlist_t *nvlin, nvlist_t *nvlout)
{
	int stayopen;

	if (!nvlist_exists_bool(nvlin, "stayopen"))
		return (EINVAL);

	stayopen = nvlist_get_bool(nvlin, "stayopen") ? 1 : 0;

	return (setpassent(stayopen) == 0 ? EFAULT : 0);
}
Пример #3
0
static void
print_default_value(const nvlist_t *parameter, const char *type)
{
	const uint8_t *mac;
	size_t size;

	if (strcasecmp(type, "bool") == 0)
		printf(" (default = %s)",
		    nvlist_get_bool(parameter, DEFAULT_SCHEMA_NAME) ? "true" :
		    "false");
	else if (strcasecmp(type, "string") == 0)
		printf(" (default = %s)",
		    nvlist_get_string(parameter, DEFAULT_SCHEMA_NAME));
	else if (strcasecmp(type, "uint8_t") == 0)
		printf(" (default = %ju)",
		    (uintmax_t)nvlist_get_number(parameter,
		    DEFAULT_SCHEMA_NAME));
	else if (strcasecmp(type, "uint16_t") == 0)
		printf(" (default = %ju)",
		    (uintmax_t)nvlist_get_number(parameter,
		    DEFAULT_SCHEMA_NAME));
	else if (strcasecmp(type, "uint32_t") == 0)
		printf(" (default = %ju)",
		    (uintmax_t)nvlist_get_number(parameter,
		    DEFAULT_SCHEMA_NAME));
	else if (strcasecmp(type, "uint64_t") == 0)
		printf(" (default = %ju)",
		    (uintmax_t)nvlist_get_number(parameter,
		    DEFAULT_SCHEMA_NAME));
	else if (strcasecmp(type, "unicast-mac") == 0) {
		mac = nvlist_get_binary(parameter, DEFAULT_SCHEMA_NAME, &size);
		printf(" (default = %02x:%02x:%02x:%02x:%02x:%02x)", mac[0],
		    mac[1], mac[2], mac[3], mac[4], mac[5]);
	} else
		errx(1, "Unexpected type in schema: '%s'", type);
}
Пример #4
0
int
main(int argc, char *argv[])
{
    int fd[2];
    socketpair(PF_UNIX, SOCK_STREAM, 0, fd);

    int kq = kqueue();
    struct kevent ke;
    memset(&ke, 0, sizeof(ke));
    EV_SET(&ke, fd[0], EVFILT_READ, EV_ADD, 0, 0, NULL);
    kevent(kq, &ke, 1, NULL, 0, NULL);
    memset(&ke, 0, sizeof(ke));
    EV_SET(&ke, fd[1], EVFILT_READ, EV_ADD, 0, 0, NULL);
    kevent(kq, &ke, 1, NULL, 0, NULL);

    signal(SIGWINCH, resize);

    nvlist_t *nvl = NULL;

    for (;;) {
        if (res) {
            struct winsize size;
            ioctl(1, TIOCGWINSZ, &size);

            nvl = nvlist_create(0);
            nvlist_add_string(nvl, "type", "resize");
            nvlist_add_number(nvl, "rows", size.ws_row);
            nvlist_add_number(nvl, "cols", size.ws_col);
            if (nvlist_send(fd[0], nvl) < 0)
                err(1, "nvlist_send()");
            nvlist_destroy(nvl);

            res = 0;
        }

        memset(&ke, 0, sizeof(ke));
        int i = kevent(kq, NULL, 0, &ke, 1, NULL);
        if (i == -1) {
            if (errno == EINTR)
                continue;
            err(1, "kevent()");
        } else if (i == 0)
            continue;

        if (ke.ident == fd[0]) {
            nvl = nvlist_recv(fd[0]);
            if (nvl == NULL)
                err(1, "nvlist_recv()");
            const char *type = nvlist_get_string(nvl, "type");
            if (strcmp(type, "ack") == 0) {
                int ok = nvlist_get_bool(nvl, "ok");
                printf("received ack, ok?: %s\n", ok ? "true" : "false");
            }
            nvlist_destroy(nvl);
        } else if (ke.ident == fd[1]) {
            nvl = nvlist_recv(fd[1]);
            if (nvl == NULL)
                err(1, "nvlist_recv()");
            const char *type = nvlist_get_string(nvl, "type");
            if (strcmp(type, "resize") == 0) {
                int rows = nvlist_get_number(nvl, "rows");
                int cows = nvlist_get_number(nvl, "cols");
                printf("got resize signal. new size: %d %d\n", rows, cows);
            }
            nvlist_destroy(nvl);
            nvl = nvlist_create(0);
            nvlist_add_string(nvl, "type", "ack");
            nvlist_add_bool(nvl, "ok", 1);
            if (nvlist_send(fd[1], nvl) < 0)
                err(1, "nvlist_send()");
            nvlist_destroy(nvl);
        }
    }
}
Пример #5
0
static void
parent(int sock)
{
	nvlist_t *nvl;
	const nvlist_t *cnvl;
	const char *name, *cname;
	void *cookie, *ccookie;
	int type, ctype;
	size_t size;

	nvl = nvlist_recv(sock);
	CHECK(nvlist_error(nvl) == 0);
	if (nvlist_error(nvl) != 0)
		err(1, "nvlist_recv() failed");

	cookie = NULL;

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_BOOL);
	CHECK(strcmp(name, "nvlist/bool/true") == 0);
	CHECK(nvlist_get_bool(nvl, name) == true);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_BOOL);
	CHECK(strcmp(name, "nvlist/bool/false") == 0);
	CHECK(nvlist_get_bool(nvl, name) == false);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/0") == 0);
	CHECK(nvlist_get_number(nvl, name) == 0);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/1") == 0);
	CHECK(nvlist_get_number(nvl, name) == 1);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/-1") == 0);
	CHECK((int)nvlist_get_number(nvl, name) == -1);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/UINT64_MAX") == 0);
	CHECK(nvlist_get_number(nvl, name) == UINT64_MAX);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/INT64_MIN") == 0);
	CHECK((int64_t)nvlist_get_number(nvl, name) == INT64_MIN);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NUMBER);
	CHECK(strcmp(name, "nvlist/number/INT64_MAX") == 0);
	CHECK((int64_t)nvlist_get_number(nvl, name) == INT64_MAX);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_STRING);
	CHECK(strcmp(name, "nvlist/string/") == 0);
	CHECK(strcmp(nvlist_get_string(nvl, name), "") == 0);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_STRING);
	CHECK(strcmp(name, "nvlist/string/x") == 0);
	CHECK(strcmp(nvlist_get_string(nvl, name), "x") == 0);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_STRING);
	CHECK(strcmp(name, "nvlist/string/abcdefghijklmnopqrstuvwxyz") == 0);
	CHECK(strcmp(nvlist_get_string(nvl, name), "abcdefghijklmnopqrstuvwxyz") == 0);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_DESCRIPTOR);
	CHECK(strcmp(name, "nvlist/descriptor/STDERR_FILENO") == 0);
	CHECK(fd_is_valid(nvlist_get_descriptor(nvl, name)));

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_BINARY);
	CHECK(strcmp(name, "nvlist/binary/x") == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, name, NULL), "x", 1) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, name, &size), "x", 1) == 0);
	CHECK(size == 1);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_BINARY);
	CHECK(strcmp(name, "nvlist/binary/abcdefghijklmnopqrstuvwxyz") == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, name, NULL), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, name, &size), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(size == sizeof("abcdefghijklmnopqrstuvwxyz"));

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name != NULL);
	CHECK(type == NV_TYPE_NVLIST);
	CHECK(strcmp(name, "nvlist/nvlist") == 0);
	cnvl = nvlist_get_nvlist(nvl, name);

	ccookie = NULL;

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_BOOL);
	CHECK(strcmp(cname, "nvlist/bool/true") == 0);
	CHECK(nvlist_get_bool(cnvl, cname) == true);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_BOOL);
	CHECK(strcmp(cname, "nvlist/bool/false") == 0);
	CHECK(nvlist_get_bool(cnvl, cname) == false);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/0") == 0);
	CHECK(nvlist_get_number(cnvl, cname) == 0);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/1") == 0);
	CHECK(nvlist_get_number(cnvl, cname) == 1);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/-1") == 0);
	CHECK((int)nvlist_get_number(cnvl, cname) == -1);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/UINT64_MAX") == 0);
	CHECK(nvlist_get_number(cnvl, cname) == UINT64_MAX);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/INT64_MIN") == 0);
	CHECK((int64_t)nvlist_get_number(cnvl, cname) == INT64_MIN);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_NUMBER);
	CHECK(strcmp(cname, "nvlist/number/INT64_MAX") == 0);
	CHECK((int64_t)nvlist_get_number(cnvl, cname) == INT64_MAX);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_STRING);
	CHECK(strcmp(cname, "nvlist/string/") == 0);
	CHECK(strcmp(nvlist_get_string(cnvl, cname), "") == 0);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_STRING);
	CHECK(strcmp(cname, "nvlist/string/x") == 0);
	CHECK(strcmp(nvlist_get_string(cnvl, cname), "x") == 0);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_STRING);
	CHECK(strcmp(cname, "nvlist/string/abcdefghijklmnopqrstuvwxyz") == 0);
	CHECK(strcmp(nvlist_get_string(cnvl, cname), "abcdefghijklmnopqrstuvwxyz") == 0);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_DESCRIPTOR);
	CHECK(strcmp(cname, "nvlist/descriptor/STDERR_FILENO") == 0);
	CHECK(fd_is_valid(nvlist_get_descriptor(cnvl, cname)));

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_BINARY);
	CHECK(strcmp(cname, "nvlist/binary/x") == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, cname, NULL), "x", 1) == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, cname, &size), "x", 1) == 0);
	CHECK(size == 1);

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname != NULL);
	CHECK(ctype == NV_TYPE_BINARY);
	CHECK(strcmp(cname, "nvlist/binary/abcdefghijklmnopqrstuvwxyz") == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, cname, NULL), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, cname, &size), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(size == sizeof("abcdefghijklmnopqrstuvwxyz"));

	cname = nvlist_next(cnvl, &ctype, &ccookie);
	CHECK(cname == NULL);

	name = nvlist_next(nvl, &type, &cookie);
	CHECK(name == NULL);
}
Пример #6
0
int
main(void)
{
	const nvlist_t *cnvl;
	nvlist_t *nvl;
	size_t size;

	printf("1..83\n");

	nvl = nvlist_create(0);

	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool/true"));
	nvlist_add_bool(nvl, "nvlist/bool/true", true);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(nvlist_get_bool(nvl, "nvlist/bool/true") == true);

	CHECK(!nvlist_exists_bool(nvl, "nvlist/bool/false"));
	nvlist_add_bool(nvl, "nvlist/bool/false", false);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(nvlist_get_bool(nvl, "nvlist/bool/false") == false);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/0"));
	nvlist_add_number(nvl, "nvlist/number/0", 0);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(nvlist_get_number(nvl, "nvlist/number/0") == 0);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/1"));
	nvlist_add_number(nvl, "nvlist/number/1", 1);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(nvlist_get_number(nvl, "nvlist/number/1") == 1);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/-1"));
	nvlist_add_number(nvl, "nvlist/number/-1", -1);
	CHECK(nvlist_error(nvl) == 0);
	CHECK((int)nvlist_get_number(nvl, "nvlist/number/-1") == -1);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/UINT64_MAX"));
	nvlist_add_number(nvl, "nvlist/number/UINT64_MAX", UINT64_MAX);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(nvlist_get_number(nvl, "nvlist/number/UINT64_MAX") == UINT64_MAX);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/INT64_MIN"));
	nvlist_add_number(nvl, "nvlist/number/INT64_MIN", INT64_MIN);
	CHECK(nvlist_error(nvl) == 0);
	CHECK((int64_t)nvlist_get_number(nvl, "nvlist/number/INT64_MIN") == INT64_MIN);

	CHECK(!nvlist_exists_number(nvl, "nvlist/number/INT64_MAX"));
	nvlist_add_number(nvl, "nvlist/number/INT64_MAX", INT64_MAX);
	CHECK(nvlist_error(nvl) == 0);
	CHECK((int64_t)nvlist_get_number(nvl, "nvlist/number/INT64_MAX") == INT64_MAX);

	CHECK(!nvlist_exists_string(nvl, "nvlist/string/"));
	nvlist_add_string(nvl, "nvlist/string/", "");
	CHECK(nvlist_error(nvl) == 0);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/"), "") == 0);

	CHECK(!nvlist_exists_string(nvl, "nvlist/string/x"));
	nvlist_add_string(nvl, "nvlist/string/x", "x");
	CHECK(nvlist_error(nvl) == 0);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/x"), "x") == 0);

	CHECK(!nvlist_exists_string(nvl, "nvlist/string/abcdefghijklmnopqrstuvwxyz"));
	nvlist_add_string(nvl, "nvlist/string/abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz");
	CHECK(nvlist_error(nvl) == 0);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/abcdefghijklmnopqrstuvwxyz"), "abcdefghijklmnopqrstuvwxyz") == 0);

	CHECK(!nvlist_exists_descriptor(nvl, "nvlist/descriptor/STDERR_FILENO"));
	nvlist_add_descriptor(nvl, "nvlist/descriptor/STDERR_FILENO", STDERR_FILENO);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(fd_is_valid(nvlist_get_descriptor(nvl, "nvlist/descriptor/STDERR_FILENO")));

	CHECK(!nvlist_exists_binary(nvl, "nvlist/binary/x"));
	nvlist_add_binary(nvl, "nvlist/binary/x", "x", 1);
	CHECK(nvlist_error(nvl) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/x", NULL), "x", 1) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/x", &size), "x", 1) == 0);
	CHECK(size == 1);

	CHECK(!nvlist_exists_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz"));
	nvlist_add_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz"));
	CHECK(nvlist_error(nvl) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", NULL), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", &size), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(size == sizeof("abcdefghijklmnopqrstuvwxyz"));

	CHECK(!nvlist_exists_nvlist(nvl, "nvlist/nvlist"));
	nvlist_add_nvlist(nvl, "nvlist/nvlist", nvl);
	CHECK(nvlist_error(nvl) == 0);
	cnvl = nvlist_get_nvlist(nvl, "nvlist/nvlist");
	CHECK(nvlist_get_bool(cnvl, "nvlist/bool/true") == true);
	CHECK(nvlist_get_bool(cnvl, "nvlist/bool/false") == false);
	CHECK(nvlist_get_number(cnvl, "nvlist/number/0") == 0);
	CHECK(nvlist_get_number(cnvl, "nvlist/number/1") == 1);
	CHECK((int)nvlist_get_number(cnvl, "nvlist/number/-1") == -1);
	CHECK(nvlist_get_number(cnvl, "nvlist/number/UINT64_MAX") == UINT64_MAX);
	CHECK((int64_t)nvlist_get_number(cnvl, "nvlist/number/INT64_MIN") == INT64_MIN);
	CHECK((int64_t)nvlist_get_number(cnvl, "nvlist/number/INT64_MAX") == INT64_MAX);
	CHECK(strcmp(nvlist_get_string(cnvl, "nvlist/string/"), "") == 0);
	CHECK(strcmp(nvlist_get_string(cnvl, "nvlist/string/x"), "x") == 0);
	CHECK(strcmp(nvlist_get_string(cnvl, "nvlist/string/abcdefghijklmnopqrstuvwxyz"), "abcdefghijklmnopqrstuvwxyz") == 0);
	/* TODO */
	CHECK(memcmp(nvlist_get_binary(cnvl, "nvlist/binary/x", NULL), "x", 1) == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, "nvlist/binary/x", &size), "x", 1) == 0);
	CHECK(size == 1);
	CHECK(memcmp(nvlist_get_binary(cnvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", NULL), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(memcmp(nvlist_get_binary(cnvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", &size), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(size == sizeof("abcdefghijklmnopqrstuvwxyz"));

	CHECK(nvlist_get_bool(nvl, "nvlist/bool/true") == true);
	CHECK(nvlist_get_bool(nvl, "nvlist/bool/false") == false);
	CHECK(nvlist_get_number(nvl, "nvlist/number/0") == 0);
	CHECK(nvlist_get_number(nvl, "nvlist/number/1") == 1);
	CHECK((int)nvlist_get_number(nvl, "nvlist/number/-1") == -1);
	CHECK(nvlist_get_number(nvl, "nvlist/number/UINT64_MAX") == UINT64_MAX);
	CHECK((int64_t)nvlist_get_number(nvl, "nvlist/number/INT64_MIN") == INT64_MIN);
	CHECK((int64_t)nvlist_get_number(nvl, "nvlist/number/INT64_MAX") == INT64_MAX);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/"), "") == 0);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/x"), "x") == 0);
	CHECK(strcmp(nvlist_get_string(nvl, "nvlist/string/abcdefghijklmnopqrstuvwxyz"), "abcdefghijklmnopqrstuvwxyz") == 0);
	CHECK(fd_is_valid(nvlist_get_descriptor(nvl, "nvlist/descriptor/STDERR_FILENO")));
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/x", NULL), "x", 1) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/x", &size), "x", 1) == 0);
	CHECK(size == 1);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", NULL), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(memcmp(nvlist_get_binary(nvl, "nvlist/binary/abcdefghijklmnopqrstuvwxyz", &size), "abcdefghijklmnopqrstuvwxyz", sizeof("abcdefghijklmnopqrstuvwxyz")) == 0);
	CHECK(size == sizeof("abcdefghijklmnopqrstuvwxyz"));

	nvlist_destroy(nvl);

	return (0);
}