Deleted Added
full compact
cam.c (297933) cam.c (298411)
1/*-
2 * Generic utility routines for the Common Access Method layer.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Generic utility routines for the Common Access Method layer.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 unchanged lines hidden (view full) ---

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/cam/cam.c 297933 2016-04-13 20:10:06Z scottl $");
30__FBSDID("$FreeBSD: head/sys/cam/cam.c 298411 2016-04-21 15:38:28Z pfg $");
31
32#include <sys/param.h>
33#ifdef _KERNEL
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/sysctl.h>
37#else /* _KERNEL */
38#include <stdlib.h>

--- 61 unchanged lines hidden (view full) ---

100 { CAM_FUNC_NOTAVAIL, "Function Not Available" },
101 { CAM_NO_NEXUS, "Nexus Not Established" },
102 { CAM_IID_INVALID, "Invalid Initiator ID" },
103 { CAM_CDB_RECVD, "CDB Received" },
104 { CAM_LUN_ALRDY_ENA, "LUN Already Enabled for Target Mode" },
105 { CAM_SCSI_BUSY, "SCSI Bus Busy" },
106};
107
31
32#include <sys/param.h>
33#ifdef _KERNEL
34#include <sys/systm.h>
35#include <sys/kernel.h>
36#include <sys/sysctl.h>
37#else /* _KERNEL */
38#include <stdlib.h>

--- 61 unchanged lines hidden (view full) ---

100 { CAM_FUNC_NOTAVAIL, "Function Not Available" },
101 { CAM_NO_NEXUS, "Nexus Not Established" },
102 { CAM_IID_INVALID, "Invalid Initiator ID" },
103 { CAM_CDB_RECVD, "CDB Received" },
104 { CAM_LUN_ALRDY_ENA, "LUN Already Enabled for Target Mode" },
105 { CAM_SCSI_BUSY, "SCSI Bus Busy" },
106};
107
108const int num_cam_status_entries =
109 sizeof(cam_status_table)/sizeof(*cam_status_table);
110
111#ifdef _KERNEL
112SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem");
113
114#ifndef CAM_DEFAULT_SORT_IO_QUEUES
115#define CAM_DEFAULT_SORT_IO_QUEUES 1
116#endif
117
118int cam_sort_io_queues = CAM_DEFAULT_SORT_IO_QUEUES;

--- 132 unchanged lines hidden (view full) ---

251 return (NULL);
252}
253
254const struct cam_status_entry*
255cam_fetch_status_entry(cam_status status)
256{
257 status &= CAM_STATUS_MASK;
258 return (bsearch(&status, &cam_status_table,
108#ifdef _KERNEL
109SYSCTL_NODE(_kern, OID_AUTO, cam, CTLFLAG_RD, 0, "CAM Subsystem");
110
111#ifndef CAM_DEFAULT_SORT_IO_QUEUES
112#define CAM_DEFAULT_SORT_IO_QUEUES 1
113#endif
114
115int cam_sort_io_queues = CAM_DEFAULT_SORT_IO_QUEUES;

--- 132 unchanged lines hidden (view full) ---

248 return (NULL);
249}
250
251const struct cam_status_entry*
252cam_fetch_status_entry(cam_status status)
253{
254 status &= CAM_STATUS_MASK;
255 return (bsearch(&status, &cam_status_table,
259 num_cam_status_entries,
256 nitems(cam_status_table),
260 sizeof(*cam_status_table),
261 camstatusentrycomp));
262}
263
264static int
265camstatusentrycomp(const void *key, const void *member)
266{
267 cam_status status;

--- 267 unchanged lines hidden ---
257 sizeof(*cam_status_table),
258 camstatusentrycomp));
259}
260
261static int
262camstatusentrycomp(const void *key, const void *member)
263{
264 cam_status status;

--- 267 unchanged lines hidden ---