History log of /freebsd-10.1-release/lib/libcam/camlib.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 259204 10-Dec-2013 nwhitehorn

MFC r257345,257382,257388:

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


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 251349 03-Jun-2013 delphij

Fix a typo: XPORT_SPI should be tested against transport, nor protocol.

Submitted by: Sascha Wildner <swildner dragonflybsd org>
Reviewed by: mjacob
MFC after: 2 weeks


# 232450 03-Mar-2012 jh

Use snprintf(3) constantly when generating CAM error messages.

PR: bin/57088
Submitted by: Rui Lopes, arundel
MFC after: 2 weeks


# 229403 03-Jan-2012 ed

Replace index() and rindex() calls with strchr() and strrchr().

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.


# 213703 11-Oct-2010 avg

camlib.c: update one overlooked comment


# 213682 11-Oct-2010 avg

cam_get_device, cam_open_device: make behavior simpler and more deterministic

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


# 184379 27-Oct-2008 marius

Supply a valid Connect ID when issuing XPT_DEV_MATCH, which
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


# 163896 01-Nov-2006 mjacob

2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.


# 158171 30-Apr-2006 marcus

Go with a different version of the previous patch so to preserve errno.

Approved by: scottl (implicit)


# 158170 30-Apr-2006 marcus

Fix a file descriptor leak in cam_lookup_pass() when the ioctl to find
the passthru device fails.

Approved by: scottl
MFC after: 1 day


# 147949 13-Jul-2005 delphij

Better memory handling:

- 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


# 132843 29-Jul-2004 scottl

Change a couple of comments so that GCC doesn't think that they contain
tri-graphs.


# 96559 14-May-2002 ken

string cleanup:

- 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


# 84199 30-Sep-2001 dillon

Add __FBSDID()s to libcam


# 79183 04-Jul-2001 mjacob

Make sure you don't have a file descriptor leak for the 'real'
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


# 56122 16-Jan-2000 mjacob

get pd_type from inquiry data itself


# 51213 12-Sep-1999 ken

Fix a file descriptor leak in cam_open_btl(). The xpt device was opened,
but never closed.

Submitted by: amobbs@allstor-sw.co.uk


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 47933 15-Jun-1999 mpp

cam_get_device() was returning 0 on failure, and 1 on success, while
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


# 41190 15-Nov-1998 ken

Use snprintf to make sure we don't overflow a buffer.


# 41189 15-Nov-1998 ken

Fix an error message. (it was using an uninitialized variable)

Reported by: dan@math.berkeley.edu (Dan Strick)


# 40271 12-Oct-1998 ken

Add a "dummy light" (actually two dummy lights) to catch people who don't
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


# 39209 15-Sep-1998 gibbs

CAM userland utility library, a replacement for libscsi.

Submitted by: "Kenneth D. Merry" <ken@FreeBSD.org>