Date: Wed, 17 May 2006 16:07:06 GMT From: Scott Long <scottl@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97344 for review Message-ID: <200605171607.k4HG76O1025196@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97344 Change 97344 by scottl@scottl-x64 on 2006/05/17 16:06:54 Don't worry about checking the device unit number in the xpt cdev routines. devfs ensures that we won't be called with an invalid unit number/minor number. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#28 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#28 (text+ko) ==== @@ -977,9 +977,6 @@ static int xptopen(struct cdev *dev, int flags, int fmt, struct thread *td) { - int unit; - - unit = minor(dev) & 0xff; /* * Only allow read-write access. @@ -991,20 +988,10 @@ * We don't allow nonblocking access. */ if ((flags & O_NONBLOCK) != 0) { - printf("xpt%d: can't do nonblocking access\n", unit); + printf("%s: can't do nonblocking access\n", devtoname(dev)); return(ENODEV); } - /* - * We only have one transport layer right now. If someone accesses - * us via something other than minor number 1, point out their - * mistake. - */ - if (unit != 0) { - printf("xptopen: got invalid xpt unit %d\n", unit); - return(ENXIO); - } - /* Mark ourselves open */ xsoftc.flags |= XPT_FLAG_OPEN; @@ -1014,20 +1001,7 @@ static int xptclose(struct cdev *dev, int flag, int fmt, struct thread *td) { - int unit; - unit = minor(dev) & 0xff; - - /* - * We only have one transport layer right now. If someone accesses - * us via something other than minor number 1, point out their - * mistake. - */ - if (unit != 0) { - printf("xptclose: got invalid xpt unit %d\n", unit); - return(ENXIO); - } - /* Mark ourselves closed */ xsoftc.flags &= ~XPT_FLAG_OPEN; @@ -1037,20 +1011,9 @@ static int xptioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) { - int unit, error; + int error; error = 0; - unit = minor(dev) & 0xff; - - /* - * We only have one transport layer right now. If someone accesses - * us via something other than minor number 1, point out their - * mistake. - */ - if (unit != 0) { - printf("xptioctl: got invalid xpt unit %d\n", unit); - return(ENXIO); - } switch(cmd) { /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605171607.k4HG76O1025196>