/* Maintained at www.Open-FCoE.org NPIV VN_Port helper functions for libfc fc_vport_create() - Create a new NPIV vport instance @vport: fc_vport structure from scsi_transport_fc @privsize: driver private data size to allocate along with the Scsi_Host  */
struct fc_lport* libfc_vport_create(struct fc_vport *vport, int privsize)
/* Maintained at www.Open-FCoE.org NPIV VN_Port helper functions for libfc fc_vport_create() - Create a new NPIV vport instance @vport: fc_vport structure from scsi_transport_fc @privsize: driver private data size to allocate along with the Scsi_Host  */
struct fc_lport* libfc_vport_create(struct fc_vport *vport, int privsize)
{
	struct Scsi_Host *shost = vport_to_shost(vport);
	struct fc_lport *n_port = shost_priv(shost);
	struct fc_lport *vn_port;
	vn_port = libfc_host_alloc(shost->hostt, privsize);
	if (!vn_port)
		goto err_out;
	if (fc_exch_mgr_list_clone(n_port, vn_port))
		goto err_put;
	vn_port->vport = vport;
	vport->dd_data = vn_port;
	mutex_lock(&n_port->lp_mutex);
	list_add_tail(&vn_port->list, &n_port->vports);
	mutex_unlock(&n_port->lp_mutex);
	return vn_port;
err_put:
	scsi_host_put(vn_port->host);
err_out:
	return NULL;
}