FreeBSD/lib/libcam/camlib.c
/*
 * Malloc/duplicate a CAM device structure.
 */
Malloc/duplicate a CAM device structure.
Malloc / duplicate a CAM device structure .
struct cam_device *
cam_device_dup(struct cam_device *device)
{
	char *func_name = "cam_device_dup";
	struct cam_device *newdev;
	if (device == NULL) {
		snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
			 "%s: device is NULL", func_name);
		return(NULL);
	}
	newdev = malloc(sizeof(struct cam_device));
	if (newdev == NULL) {
		snprintf(cam_errbuf, CAM_ERRBUF_SIZE,
			"%s: couldn't malloc CAM device structure", func_name);
		return(NULL);
	}
	bcopy(device, newdev, sizeof(struct cam_device));
	return(newdev);
}
struct cam_device * cam_device_dup ( struct cam_device * device ) { char * func_name = " " ; struct cam_device * newdev ; if ( device == NULL ) { snprintf ( cam_errbuf , CAM_ERRBUF_SIZE , " " , func_name ) ; return ( NULL ) ; } newdev = malloc ( sizeof ( struct cam_device ) ) ; if ( newdev == NULL ) { snprintf ( cam_errbuf , CAM_ERRBUF_SIZE , " " , func_name ) ; return ( NULL ) ; } bcopy ( device , newdev , sizeof ( struct cam_device ) ) ; return ( newdev ) ; }
Malloc/duplicate a CAM device structure.
Malloc / duplicate a CAM device structure .