Deleted Added
sdiff udiff text old ( 287806 ) new ( 293350 )
full compact
1/*-
2 * Copyright (c) 1997 Justin T. Gibbs.
3 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

63 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
64 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
65 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * SUCH DAMAGE.
68 */
69
70#include <sys/cdefs.h>
71__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_ch.c 287806 2015-09-15 05:09:17Z markj $");
72
73#include <sys/param.h>
74#include <sys/queue.h>
75#include <sys/systm.h>
76#include <sys/kernel.h>
77#include <sys/types.h>
78#include <sys/malloc.h>
79#include <sys/fcntl.h>

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

367}
368
369static cam_status
370chregister(struct cam_periph *periph, void *arg)
371{
372 struct ch_softc *softc;
373 struct ccb_getdev *cgd;
374 struct ccb_pathinq cpi;
375
376 cgd = (struct ccb_getdev *)arg;
377 if (cgd == NULL) {
378 printf("chregister: no getdev CCB, can't register device\n");
379 return(CAM_REQ_CMP_ERR);
380 }
381
382 softc = (struct ch_softc *)malloc(sizeof(*softc),M_DEVBUF,M_NOWAIT);

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

426 xpt_print(periph->path, "%s: lost periph during "
427 "registration!\n", __func__);
428 cam_periph_lock(periph);
429 return (CAM_REQ_CMP_ERR);
430 }
431
432
433 /* Register the device */
434 softc->dev = make_dev(&ch_cdevsw, periph->unit_number, UID_ROOT,
435 GID_OPERATOR, 0600, "%s%d", periph->periph_name,
436 periph->unit_number);
437 cam_periph_lock(periph);
438 softc->dev->si_drv1 = periph;
439
440 /*
441 * Add an async callback so that we get
442 * notified if this device goes away.
443 */
444 xpt_register_async(AC_LOST_DEVICE, chasync, periph, periph->path);
445
446 /*

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

502static int
503chclose(struct cdev *dev, int flag, int fmt, struct thread *td)
504{
505 struct cam_periph *periph;
506 struct ch_softc *softc;
507 struct mtx *mtx;
508
509 periph = (struct cam_periph *)dev->si_drv1;
510 if (periph == NULL)
511 return(ENXIO);
512 mtx = cam_periph_mtx(periph);
513 mtx_lock(mtx);
514
515 softc = (struct ch_softc *)periph->softc;
516 softc->open_count--;
517
518 cam_periph_release_locked(periph);
519

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

749static int
750chioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
751{
752 struct cam_periph *periph;
753 struct ch_softc *softc;
754 int error;
755
756 periph = (struct cam_periph *)dev->si_drv1;
757 if (periph == NULL)
758 return(ENXIO);
759
760 cam_periph_lock(periph);
761 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering chioctl\n"));
762
763 softc = (struct ch_softc *)periph->softc;
764
765 error = 0;
766
767 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE,

--- 1167 unchanged lines hidden ---