From owner-freebsd-scsi@FreeBSD.ORG Fri Apr 23 18:44:14 2010 Return-Path: Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2DEE41065670 for ; Fri, 23 Apr 2010 18:44:14 +0000 (UTC) (envelope-from ken@kdm.org) Received: from nargothrond.kdm.org (nargothrond.kdm.org [70.56.43.81]) by mx1.freebsd.org (Postfix) with ESMTP id DE0FB8FC14 for ; Fri, 23 Apr 2010 18:44:13 +0000 (UTC) Received: from nargothrond.kdm.org (localhost [127.0.0.1]) by nargothrond.kdm.org (8.14.2/8.14.2) with ESMTP id o3NIiDNp006132; Fri, 23 Apr 2010 12:44:13 -0600 (MDT) (envelope-from ken@nargothrond.kdm.org) Received: (from ken@localhost) by nargothrond.kdm.org (8.14.2/8.14.2/Submit) id o3NIiDMi006131; Fri, 23 Apr 2010 12:44:13 -0600 (MDT) (envelope-from ken) Date: Fri, 23 Apr 2010 12:44:12 -0600 From: "Kenneth D. Merry" To: Andriy Gapon Message-ID: <20100423184412.GA5016@nargothrond.kdm.org> References: <4BCDEBF6.3030609@icyb.net.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4BCDEBF6.3030609@icyb.net.ua> User-Agent: Mutt/1.4.2i Cc: freebsd-scsi@freebsd.org Subject: Re: cam.3: do not discourage use of cam_open_device X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2010 18:44:14 -0000 On Tue, Apr 20, 2010 at 21:01:26 +0300, Andriy Gapon wrote: > > This is based on my understanding what Scott Long tried to explain me a while ago. > > Index: lib/libcam/cam.3 > =================================================================== > --- lib/libcam/cam.3 (revision 206902) > +++ lib/libcam/cam.3 (working copy) > @@ -190,12 +190,6 @@ > Once the device name and unit number > are determined, a lookup is performed to determine the passthrough device > that corresponds to the given device. > -.Fn cam_open_device > -is rather simple to use, but it is not really suitable for general use > -because its behavior is not necessarily deterministic. > -Programmers writing > -new applications should make the extra effort to use one of the other open > -routines documented below. > .Pp > .Fn cam_open_spec_device > opens the > > > It seems that this warning about ambiguity came from pre-devfs days when e.g. cd0 > nodes in different directories could correspond to different actual SCSI > peripherals. It seems that there wasn't an ambiguity if an absolute device path > was given. > > Nowadays, cam_open_device seems to always do a proper job of finding a correct > pass device. The warning had more to do with the ambiguity trying to make sense of device names than having different device nodes lying around. cam_get_device() (which is called by cam_open_device()) tries to do some things that will break on devices that start with n (unless it's a non-rewound tape device) or r. Right now we don't have any CAM peripheral drivers that start with those letters, so it works. It also won't do the right thing on devices with gpt partitions. Some of that can be fixed, though. So it's mostly deterministic, but it may not do exactly what you expect. It may be good to keep some statement in there pointing people to the other routines as being preferred because they're a little more deterministic. Ken -- Kenneth Merry ken@FreeBSD.ORG