Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Mar 2007 23:09:47 GMT
From:      Scott Long <scottl@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 116891 for review
Message-ID:  <200703292309.l2TN9lnx065633@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=116891

Change 116891 by scottl@scottl-x64 on 2007/03/29 23:09:05

	Elimiate the xptpriv field from the ccb_hdr.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#13 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#52 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/cam_ccb.h#13 (text+ko) ====

@@ -272,7 +272,6 @@
 	u_int32_t	flags;		/* ccb_flags */
 	ccb_ppriv_area	periph_priv;
 	ccb_spriv_area	sim_priv;
-	void		*xptpriv;	/* Holds a task object if needed */
 	u_int32_t	timeout;	/* Timeout value */
 
 	/*

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#52 (text+ko) ====

@@ -71,6 +71,12 @@
 /* Datastructures internal to the xpt layer */
 MALLOC_DEFINE(M_CAMXPT, "CAM XPT", "CAM XPT buffers");
 
+/* Object for defering XPT actions to a taskqueue */
+struct xpt_task {
+	struct task	task;
+	void		*data;
+};
+
 /*
  * Definition of an async handler callback block.  These are used to add
  * SIMs and peripherals to the async callback lists.
@@ -2992,13 +2998,15 @@
 xpt_action_sasync_cb(void *context, int pending)
 {
 	union ccb *start_ccb;
+	struct xpt_task *task;
 	struct ccb_setasync *csa;
 	struct async_node *cur_entry;
 	struct async_list *async_head;
 	u_int32_t added;
 	int s;
 
-	start_ccb = (union ccb *)context;
+	task = (struct xpt_task *)context;
+	start_ccb = (union ccb *)task->data;
 	csa = &start_ccb->csa;
 	added = csa->event_enable;
 	async_head = &csa->ccb_h.path->device->asyncs;
@@ -3063,9 +3071,9 @@
 	splx(s);
 
 out:
-	free(start_ccb->ccb_h.xptpriv, M_CAMXPT);
 	xpt_free_path(start_ccb->ccb_h.path);
 	xpt_free_ccb(start_ccb);
+	free(task, M_CAMXPT);
 }
 
 void
@@ -3471,7 +3479,7 @@
 	case XPT_SASYNC_CB:
 	{
 		union ccb *task_ccb;
-		struct task *task;
+		struct xpt_task *task;
 
 		/*
 		 * Need to decouple this operation via a taqskqueue so that
@@ -3494,7 +3502,7 @@
 			break;
 		}
 
-		task = malloc(sizeof(struct task), M_CAMXPT, M_NOWAIT);
+		task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT);
 		if (task == NULL) {
 			start_ccb->ccb_h.status = CAM_RESRC_UNAVAIL;
 			xpt_free_path(task_ccb->ccb_h.path);
@@ -3502,9 +3510,9 @@
 			break;
 		}
 
-		TASK_INIT(task, 0, xpt_action_sasync_cb, task_ccb);
-		task_ccb->ccb_h.xptpriv = task;
-		taskqueue_enqueue(taskqueue_thread, task);
+		TASK_INIT(&task->task, 0, xpt_action_sasync_cb, task);
+		task->data = task_ccb;
+		taskqueue_enqueue(taskqueue_thread, &task->task);
 
 		start_ccb->ccb_h.status = CAM_REQ_CMP;
 		break;
@@ -7159,7 +7167,7 @@
 static void
 xpt_finishconfig(struct cam_periph *periph, union ccb *done_ccb)
 {
-	struct	task *task;
+	struct	task *xpt_task;
 
 	if (done_ccb != NULL) {
 		CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE,
@@ -7182,10 +7190,10 @@
 		}
 	}
 
-	task = malloc(sizeof(struct task), M_CAMXPT, M_NOWAIT);
+	task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT);
 	if (task != NULL) {
-		TASK_INIT(task, 0, xpt_finishconfig_task, task);
-		taskqueue_enqueue(taskqueue_thread, task);
+		TASK_INIT(&task->task, 0, xpt_finishconfig_task, task);
+		taskqueue_enqueue(taskqueue_thread, &task->task);
 	}
 
 	if (done_ccb != NULL)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200703292309.l2TN9lnx065633>