From owner-p4-projects@FreeBSD.ORG Wed May 17 16:07:28 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C089216AD72; Wed, 17 May 2006 16:07:28 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 775CE16AC7D for ; Wed, 17 May 2006 16:07:27 +0000 (UTC) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 25AF743D67 for ; Wed, 17 May 2006 16:07:27 +0000 (GMT) (envelope-from scottl@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4HG76nq025199 for ; Wed, 17 May 2006 16:07:06 GMT (envelope-from scottl@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4HG76O1025196 for perforce@freebsd.org; Wed, 17 May 2006 16:07:06 GMT (envelope-from scottl@freebsd.org) Date: Wed, 17 May 2006 16:07:06 GMT Message-Id: <200605171607.k4HG76O1025196@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to scottl@freebsd.org using -f From: Scott Long To: Perforce Change Reviews Cc: Subject: PERFORCE change 97344 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 May 2006 16:07:32 -0000 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) { /*