FreeBSD/sbin/hastd/nv.c
/*
 * Convert the given nv structure to network byte order and return ebuf
 * structure.
 */
Convert the given nv structure to network byte order and return ebuf
structure.
Convert the given nv structure to network byte order and return ebuf structure .
struct ebuf *
nv_hton(struct nv *nv)
{
	struct nvhdr *nvh;
	unsigned char *ptr;
	size_t size;
	NV_CHECK(nv);
	PJDLOG_ASSERT(nv->nv_error == 0);
	ptr = ebuf_data(nv->nv_ebuf, &size);
	while (size > 0) {
		PJDLOG_ASSERT(size >= sizeof(*nvh) + 2);
		nvh = (struct nvhdr *)ptr;
		PJDLOG_ASSERT(NVH_SIZE(nvh) <= size);
		nv_swap(nvh, false);
		ptr += NVH_SIZE(nvh);
		size -= NVH_SIZE(nvh);
	}
	return (nv->nv_ebuf);
}
struct ebuf * nv_hton ( struct nv * nv ) { struct nvhdr * nvh ; unsigned char * ptr ; size_t size ; NV_CHECK ( nv ) ; PJDLOG_ASSERT ( nv -> nv_error == 0 ) ; ptr = ebuf_data ( nv -> nv_ebuf , & size ) ; while ( size > 0 ) { PJDLOG_ASSERT ( size >= sizeof ( * nvh ) + 2 ) ; nvh = ( struct nvhdr * ) ptr ; PJDLOG_ASSERT ( NVH_SIZE ( nvh ) <= size ) ; nv_swap ( nvh , false ) ; ptr += NVH_SIZE ( nvh ) ; size -= NVH_SIZE ( nvh ) ; } return ( nv -> nv_ebuf ) ; }
Convert the given nv structure to network byte order and return ebuf
 structure.
Convert the given nv structure to network byte order and return ebuf structure .
/*
		 * Minimum size at this point is size of nvhdr structure,
		 * one character long name plus terminating '\0'.
		 */