summaryrefslogtreecommitdiffstats
path: root/lib/libcam/camlib.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r257345,257382,257388:nwhitehorn2013-12-101-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Implement extended LUN support. If PIM_EXTLUNS is set by a SIM, encode the upper 32-bits of the LUN, if possible, into the target_lun field as passed directly from the REPORT LUNs response. This allows extended LUN support to work for all LUNs with zeros in the lower 32-bits, which covers most addressing modes without breaking KBI. Behavior for drivers not setting PIM_EXTLUNS is unchanged. No user-facing interfaces are modified. Extended LUNs are stored with swizzled 16-bit word order so that, for devices implementing LUN addressing (like SCSI-2), the numerical representation of the LUN is identical with and without PIM_EXTLUNS. Thus setting PIM_EXTLUNS keeps most behavior, and user-facing LUN IDs, unchanged. This follows the strategy used in Solaris. A macro (CAM_EXTLUN_BYTE_SWIZZLE) is provided to transform a lun_id_t into a uint64_t ordered for the wire. This is the second part of work for full 64-bit extended LUN support and is designed to a bridge for stable/10 to the final 64-bit LUN code. The third and final part will involve widening lun_id_t to 64 bits and will not be MFCed. This third part will break the KBI but will keep the KPI unchanged so that all drivers that will care about this can be updated now and not require code changes between HEAD and stable/10. Reviewed by: scottl
* Fix a typo: XPORT_SPI should be tested against transport, nor protocol.delphij2013-06-031-1/+1
| | | | | | Submitted by: Sascha Wildner <swildner dragonflybsd org> Reviewed by: mjacob MFC after: 2 weeks
* Use snprintf(3) constantly when generating CAM error messages.jh2012-03-031-44/+58
| | | | | | PR: bin/57088 Submitted by: Rui Lopes, arundel MFC after: 2 weeks
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* camlib.c: update one overlooked commentavg2010-10-111-3/+3
|
* cam_get_device, cam_open_device: make behavior simpler and more deterministicavg2010-10-111-85/+19
| | | | | | | | | | | | | | | | Remove or re-work support for the several features from the past: - remove incomplete support for trimming slice/partition names - remove mapping from old device names "sd" and "st" - remove whitespace trimming - remove unconditional skipping of leading 'r' in a device name - skip leading 'n' or 'e' only if the following device name matches a list of known devices that support no-rewind and eject-on-close features; currently this is only sa(4) - reflect the above changes in comments in code and in cam(3) - remove a note cautioning against use of cam_get_device and cam_open_device in cam(3) Reviewed by: mjacob
* Supply a valid Connect ID when issuing XPT_DEV_MATCH, whichmarius2008-10-271-0/+3
| | | | | | | | | | | | | | according to my reading of the CAM draft is mandatory for all CCB function calls and enforced by xptioctl() since at least r168752. Previously we happened to use 0 as the Path ID, causing the XPT_DEV_MATCH call to fail if there's no SCSI bus 0. Basically the same bug was also fixed the same way for camcontrol(8) as part of r126514. PR: 127605 Submitted by: Eygene Ryabinkin Approved by: silence from ken and scottl MFC after: 1 week
* 2nd and final commit that moves us to CAM_NEW_TRAN_CODEmjacob2006-11-021-4/+12
| | | | | | as the default. Reviewed by multitudes.
* Go with a different version of the previous patch so to preserve errno.marcus2006-04-301-5/+5
| | | | Approved by: scottl (implicit)
* Fix a file descriptor leak in cam_lookup_pass() when the ioctl to findmarcus2006-04-301-4/+5
| | | | | | | the passthru device fails. Approved by: scottl MFC after: 1 day
* Better memory handling:delphij2005-07-131-4/+7
| | | | | | | | | | | | - It is acceptable to call free(3) when the given pointer itself is NULL, so we do not need to determine NULL before passing a pointer to free(3) - Handle failure of malloc(3) MT6/5 Candidate Submitted by: Dan Lukes <dan at obluda cz> PR: bin/83352
* Change a couple of comments so that GCC doesn't think that they containscottl2004-07-291-3/+3
| | | | tri-graphs.
* string cleanup:ken2002-05-141-14/+12
| | | | | | | | | | | - fix a potential overrun made worse by rev 1.5 of camlib.h - change strncpy() and strcpy() calls to strlcpy() - use sizeof(string[]) instead of STRING_LEN to avoid future problems - get rid of an unused variable Thanks to BDE for pointing out some of the problems. MFC after: 2 weeks
* Add __FBSDID()s to libcamdillon2001-09-301-2/+3
|
* Make sure you don't have a file descriptor leak for the 'real'mjacob2001-07-041-1/+5
| | | | | | | | | | underlying CAM device. This needs to be checked not only in the open routine, but the device->fd has to be initialized as well. PR: 28688 Submitted (partially) by: T. William Wells <bill@twwells.com> MFC after: 2 weeks
* get pd_type from inquiry data itselfmjacob2000-01-161-1/+1
|
* Fix a file descriptor leak in cam_open_btl(). The xpt device was opened,ken1999-09-121-1/+5
| | | | | | but never closed. Submitted by: amobbs@allstor-sw.co.uk
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* cam_get_device() was returning 0 on failure, and 1 on success, whilempp1999-06-151-10/+10
| | | | | | | | camcontrol(8) and the documentation in camlib.c and cam(3) all expect -1 on failure and 0 on success. Updated camlib.c to return the values specified by the documentation. PR: 12023
* Use snprintf to make sure we don't overflow a buffer.ken1998-11-151-4/+5
|
* Fix an error message. (it was using an uninitialized variable)ken1998-11-151-2/+2
| | | | Reported by: dan@math.berkeley.edu (Dan Strick)
* Add a "dummy light" (actually two dummy lights) to catch people who don'tken1998-10-121-4/+27
| | | | | | | | | have the passthrough device configured in their kernel. This will hopefully reduce the number of people complaining that they can't get {camcontrol, xmcd, tosha, cdrecord, etc.} to work. Reviewed by: gibbs
* CAM userland utility library, a replacement for libscsi.gibbs1998-09-151-0/+757
Submitted by: "Kenneth D. Merry" <ken@FreeBSD.org>
OpenPOWER on IntegriCloud