svn commit: r255562 - in stable/9: share/examples/scsi_target sys/cam/scsi

Alexander Motin mav at FreeBSD.org
Sat Sep 14 10:00:21 UTC 2013


Author: mav
Date: Sat Sep 14 10:00:20 2013
New Revision: 255562
URL: http://svnweb.freebsd.org/changeset/base/255562

Log:
  MFC r255120:
  Bring legacy CAM target implementation back into API/KPI-coherent and even
  functional state.  While CTL is much more superior target from all points,
  there is no reason why this code should not work.

Modified:
  stable/9/share/examples/scsi_target/scsi_target.c
  stable/9/sys/cam/scsi/scsi_targ_bh.c
  stable/9/sys/cam/scsi/scsi_target.c
Directory Properties:
  stable/9/share/examples/scsi_target/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/share/examples/scsi_target/scsi_target.c
==============================================================================
--- stable/9/share/examples/scsi_target/scsi_target.c	Sat Sep 14 09:53:57 2013	(r255561)
+++ stable/9/share/examples/scsi_target/scsi_target.c	Sat Sep 14 10:00:20 2013	(r255562)
@@ -371,7 +371,7 @@ init_ccbs()
 	for (i = 0; i < MAX_INITIATORS; i++) {
 		struct ccb_accept_tio *atio;
 		struct atio_descr *a_descr;
-		struct ccb_immed_notify *inot;
+		struct ccb_immediate_notify *inot;
 
 		atio = (struct ccb_accept_tio *)malloc(sizeof(*atio));
 		if (atio == NULL) {
@@ -388,7 +388,7 @@ init_ccbs()
 		atio->ccb_h.targ_descr = a_descr;
 		send_ccb((union ccb *)atio, /*priority*/1);
 
-		inot = (struct ccb_immed_notify *)malloc(sizeof(*inot));
+		inot = (struct ccb_immediate_notify *)malloc(sizeof(*inot));
 		if (inot == NULL) {
 			warn("malloc INOT");
 			return (-1);
@@ -599,7 +599,7 @@ handle_read()
 			oo += run_queue(c_descr->atio);
 			break;
 		}
-		case XPT_IMMED_NOTIFY:
+		case XPT_IMMEDIATE_NOTIFY:
 			/* INOTs are handled with priority */
 			TAILQ_INSERT_HEAD(&work_queue, &ccb->ccb_h,
 					  periph_links.tqe);
@@ -909,7 +909,7 @@ free_ccb(union ccb *ccb)
 	case XPT_ACCEPT_TARGET_IO:
 		free(ccb->ccb_h.targ_descr);
 		/* FALLTHROUGH */
-	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	default:
 		free(ccb);
 		break;

Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_targ_bh.c	Sat Sep 14 09:53:57 2013	(r255561)
+++ stable/9/sys/cam/scsi/scsi_targ_bh.c	Sat Sep 14 10:00:20 2013	(r255562)
@@ -305,10 +305,10 @@ targbhenlun(struct cam_periph *periph)
 	 * so the SIM can tell us of asynchronous target mode events.
 	 */
 	for (i = 0; i < MAX_ACCEPT; i++) {
-		struct ccb_immed_notify *inot;
+		struct ccb_immediate_notify *inot;
 
-		inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_SCSIBH,
-						        M_NOWAIT);
+		inot = (struct ccb_immediate_notify*)malloc(sizeof(*inot),
+			    M_SCSIBH, M_NOWAIT);
 
 		if (inot == NULL) {
 			status = CAM_RESRC_UNAVAIL;
@@ -316,7 +316,7 @@ targbhenlun(struct cam_periph *periph)
 		}
 
 		xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL);
-		inot->ccb_h.func_code = XPT_IMMED_NOTIFY;
+		inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY;
 		inot->ccb_h.cbfcnp = targbhdone;
 		SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h,
 				  periph_links.sle);
@@ -712,7 +712,7 @@ targbhdone(struct cam_periph *periph, un
 		}
 		break;
 	}
-	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	{
 		int frozen;
 

Modified: stable/9/sys/cam/scsi/scsi_target.c
==============================================================================
--- stable/9/sys/cam/scsi/scsi_target.c	Sat Sep 14 09:53:57 2013	(r255561)
+++ stable/9/sys/cam/scsi/scsi_target.c	Sat Sep 14 10:00:20 2013	(r255562)
@@ -590,6 +590,7 @@ targwrite(struct cdev *dev, struct uio *
 		switch (func_code) {
 		case XPT_ACCEPT_TARGET_IO:
 		case XPT_IMMED_NOTIFY:
+		case XPT_IMMEDIATE_NOTIFY:
 			cam_periph_lock(softc->periph);
 			ccb = targgetccb(softc, func_code, priority);
 			descr = (struct targ_cmd_descr *)ccb->ccb_h.targ_descr;
@@ -820,6 +821,7 @@ targdone(struct cam_periph *periph, unio
 	switch (done_ccb->ccb_h.func_code) {
 	/* All FC_*_QUEUED CCBs go back to userland */
 	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 	case XPT_ACCEPT_TARGET_IO:
 	case XPT_CONT_TARGET_IO:
 		TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h,
@@ -1000,6 +1002,7 @@ targfreeccb(struct targ_softc *softc, un
 	switch (ccb->ccb_h.func_code) {
 	case XPT_ACCEPT_TARGET_IO:
 	case XPT_IMMED_NOTIFY:
+	case XPT_IMMEDIATE_NOTIFY:
 		CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb));
 		free(ccb, M_TARG);
 		break;
@@ -1182,6 +1185,9 @@ targccblen(xpt_opcode func_code)
 	case XPT_IMMED_NOTIFY:
 		len = sizeof(struct ccb_immed_notify);
 		break;
+	case XPT_IMMEDIATE_NOTIFY:
+		len = sizeof(struct ccb_immediate_notify);
+		break;
 	case XPT_REL_SIMQ:
 		len = sizeof(struct ccb_relsim);
 		break;


More information about the svn-src-stable-9 mailing list