PERFORCE change 97344 for review
Scott Long
scottl at FreeBSD.org
Wed May 17 16:07:32 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=97344
Change 97344 by scottl at 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) {
/*
More information about the p4-projects
mailing list