FreeBSD/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
/*
 * Routines specific to "zfs recv"
 */
Routines specific to "zfs recv"
Routines specific to " zfs recv "
static int
recv_read(libzfs_handle_t *hdl, int fd, void *buf, int ilen,
    boolean_t byteswap, zio_cksum_t *zc)
{
	char *cp = buf;
	int rv;
	int len = ilen;
	assert(ilen <= SPA_MAXBLOCKSIZE);
	do {
		rv = read(fd, cp, len);
		cp += rv;
		len -= rv;
	} while (rv > 0);
	if (rv < 0 || len != 0) {
		zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
		    "failed to read from stream"));
		return (zfs_error(hdl, EZFS_BADSTREAM, dgettext(TEXT_DOMAIN,
		    "cannot receive")));
	}
	if (zc) {
		if (byteswap)
			fletcher_4_incremental_byteswap(buf, ilen, zc);
		else
			fletcher_4_incremental_native(buf, ilen, zc);
	}
	return (0);
}
static int recv_read ( libzfs_handle_t * hdl , int fd , void * buf , int ilen , boolean_t byteswap , zio_cksum_t * zc ) { char * cp = buf ; int rv ; int len = ilen ; assert ( ilen <= SPA_MAXBLOCKSIZE ) ; do { rv = read ( fd , cp , len ) ; cp += rv ; len -= rv ; } while ( rv > 0 ) ; if ( rv < 0 || len != 0 ) { zfs_error_aux ( hdl , dgettext ( TEXT_DOMAIN , " " ) ) ; return ( zfs_error ( hdl , EZFS_BADSTREAM , dgettext ( TEXT_DOMAIN , " " ) ) ) ; } if ( zc ) { if ( byteswap ) fletcher_4_incremental_byteswap ( buf , ilen , zc ) ; else fletcher_4_incremental_native ( buf , ilen , zc ) ; } return ( 0 ) ; }
Routines specific to "zfs recv"
Routines specific to " zfs recv "