scsi_da.c (ce9edcf5b53a0eadcd0f5d25d39b9517f0c5cf40) scsi_da.c (49ff4debd3d4c155448b2b4e3b95b17d9eb575ed)
1/*
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 11 unchanged lines hidden (view full) ---

20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: scsi_da.c,v 1.30 1999/07/07 18:14:01 mjacob Exp $
28 * $Id: scsi_da.c,v 1.31 1999/08/09 10:34:30 phk Exp $
29 */
30
31#include "opt_hw_wdog.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/buf.h>

--- 337 unchanged lines hidden (view full) ---

374 label.d_secperunit = softc->params.sectors;
375
376 if ((dsisopen(softc->dk_slices) == 0)
377 && ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0)) {
378 daprevent(periph, PR_PREVENT);
379 }
380
381 /* Initialize slice tables. */
29 */
30
31#include "opt_hw_wdog.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/buf.h>

--- 337 unchanged lines hidden (view full) ---

374 label.d_secperunit = softc->params.sectors;
375
376 if ((dsisopen(softc->dk_slices) == 0)
377 && ((softc->flags & DA_FLAG_PACK_REMOVABLE) != 0)) {
378 daprevent(periph, PR_PREVENT);
379 }
380
381 /* Initialize slice tables. */
382 error = dsopen("da", dev, fmt, 0, &softc->dk_slices, &label,
383 dastrategy, (ds_setgeom_t *)NULL,
384 &da_cdevsw);
382 error = dsopen("da", dev, fmt, 0, &softc->dk_slices, &label);
385
386 /*
387 * Check to see whether or not the blocksize is set yet.
388 * If it isn't, set it and then clear the blocksize
389 * unavailable flag for the device statistics.
390 */
391 if ((softc->device_stats.flags & DEVSTAT_BS_UNAVAILABLE) != 0){
392 softc->device_stats.block_size = softc->params.secsize;

--- 202 unchanged lines hidden (view full) ---

595
596 if (cmd == DIOCSBAD)
597 return (EINVAL); /* XXX */
598
599 if ((error = cam_periph_lock(periph, PRIBIO|PCATCH)) != 0) {
600 return (error); /* error code from tsleep */
601 }
602
383
384 /*
385 * Check to see whether or not the blocksize is set yet.
386 * If it isn't, set it and then clear the blocksize
387 * unavailable flag for the device statistics.
388 */
389 if ((softc->device_stats.flags & DEVSTAT_BS_UNAVAILABLE) != 0){
390 softc->device_stats.block_size = softc->params.secsize;

--- 202 unchanged lines hidden (view full) ---

593
594 if (cmd == DIOCSBAD)
595 return (EINVAL); /* XXX */
596
597 if ((error = cam_periph_lock(periph, PRIBIO|PCATCH)) != 0) {
598 return (error); /* error code from tsleep */
599 }
600
603 error = dsioctl("da", dev, cmd, addr, flag, &softc->dk_slices,
604 dastrategy, (ds_setgeom_t *)NULL);
601 error = dsioctl("da", dev, cmd, addr, flag, &softc->dk_slices);
605
606 if (error == ENOIOCTL)
607 error = cam_periph_ioctl(periph, cmd, addr, daerror);
608
609 cam_periph_unlock(periph);
610
611 return (error);
612}

--- 157 unchanged lines hidden (view full) ---

770 struct da_softc *softc;
771
772 periph = cam_extend_get(daperiphs, dkunit(dev));
773 if (periph == NULL)
774 return (ENXIO);
775
776 softc = (struct da_softc *)periph->softc;
777
602
603 if (error == ENOIOCTL)
604 error = cam_periph_ioctl(periph, cmd, addr, daerror);
605
606 cam_periph_unlock(periph);
607
608 return (error);
609}

--- 157 unchanged lines hidden (view full) ---

767 struct da_softc *softc;
768
769 periph = cam_extend_get(daperiphs, dkunit(dev));
770 if (periph == NULL)
771 return (ENXIO);
772
773 softc = (struct da_softc *)periph->softc;
774
778 return (dssize(dev, &softc->dk_slices, daopen, daclose));
775 return (dssize(dev, &softc->dk_slices));
779}
780
781static void
782dainit(void)
783{
784 cam_status status;
785 struct cam_path *path;
786

--- 832 unchanged lines hidden ---
776}
777
778static void
779dainit(void)
780{
781 cam_status status;
782 struct cam_path *path;
783

--- 832 unchanged lines hidden ---