Deleted Added
full compact
30c30
< __FBSDID("$FreeBSD: head/sys/cam/cam_sim.c 147723 2005-07-01 15:21:30Z avatar $");
---
> __FBSDID("$FreeBSD: head/sys/cam/cam_sim.c 168752 2007-04-15 08:49:19Z scottl $");
35a36,37
> #include <sys/lock.h>
> #include <sys/mutex.h>
61c63
< int max_dev_transactions,
---
> struct mtx *mtx, int max_dev_transactions,
66,77c68,69
< /*
< * If this is the xpt layer creating a sim, then it's OK
< * to wait for an allocation.
< *
< * XXX Should we pass in a flag to indicate that wait is OK?
< */
< if (strcmp(sim_name, "xpt") == 0)
< sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
< M_CAMSIM, M_WAITOK);
< else
< sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
< M_CAMSIM, M_NOWAIT);
---
> if (mtx == NULL)
> return (NULL);
79,91c71,94
< if (sim != NULL) {
< sim->sim_action = sim_action;
< sim->sim_poll = sim_poll;
< sim->sim_name = sim_name;
< sim->softc = softc;
< sim->path_id = CAM_PATH_ANY;
< sim->unit_number = unit;
< sim->bus_id = 0; /* set in xpt_bus_register */
< sim->max_tagged_dev_openings = max_tagged_dev_transactions;
< sim->max_dev_openings = max_dev_transactions;
< sim->flags = 0;
< callout_handle_init(&sim->c_handle);
< sim->devq = queue;
---
> sim = (struct cam_sim *)malloc(sizeof(struct cam_sim),
> M_CAMSIM, M_NOWAIT);
>
> if (sim == NULL)
> return (NULL);
>
> sim->sim_action = sim_action;
> sim->sim_poll = sim_poll;
> sim->sim_name = sim_name;
> sim->softc = softc;
> sim->path_id = CAM_PATH_ANY;
> sim->unit_number = unit;
> sim->bus_id = 0; /* set in xpt_bus_register */
> sim->max_tagged_dev_openings = max_tagged_dev_transactions;
> sim->max_dev_openings = max_dev_transactions;
> sim->flags = 0;
> sim->devq = queue;
> sim->mtx = mtx;
> if (mtx == &Giant) {
> sim->flags |= 0;
> callout_init(&sim->callout, 0);
> } else {
> sim->flags |= CAM_SIM_MPSAFE;
> callout_init(&sim->callout, 1);
93a97,98
> SLIST_INIT(&sim->ccb_freeq);
>