/*
* iSCSI driver for Linux
* Copyright (C) 2001 Cisco Systems, Inc.
* maintained by linux-iscsi-devel@lists.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* See the file COPYING included with this distribution for more details.
*
* $Id: iscsi.c,v 1.1.2.8 2005/06/27 17:26:47 mikenc Exp $
*
*/
#include <linux/config.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/byteorder.h>
#include <asm/atomic.h>
#include <linux/stddef.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/file.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/blk.h>
#include <linux/types.h>
#include <linux/stat.h>
#include <linux/config.h>
#include <linux/poll.h>
#include <linux/smp_lock.h>
#include <linux/kernel.h>
#include <linux/wait.h>
#include <linux/net.h>
#include <linux/in.h>
#include <linux/tcp.h>
#include <net/sock.h>
#include <linux/socket.h>
#include <linux/errno.h>
#include <linux/unistd.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
#include <scsi/sg.h>
#include <linux/inetdevice.h>
#include <linux/route.h>
#include <net/route.h>
/*
* These header files are required for Shutdown Notification routines
*/
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
/* these are from $(TOPDIR)/drivers/scsi, not $(TOPDIR)/include */
#include "scsi.h"
#include "hosts.h"
/* if non-zero, do a TCP Abort when a session drops, instead
* of (attempting) a graceful TCP Close
*/
#define TCP_ABORT_ON_DROP 0
#define RETRIES_BLOCK_DEVICES 1
/* some targets, such as the Intel Labs target on SourceForge, make
* invalid assumptions about the relateive ordering of command and
* data PDUs, but still advertise a CmdSN window greater than one
* command. When this is non-zero, we try to break ourselves in such
* a way that the target's bogus assumptions are met. No promises
* though, since we may send Nops or task mgmt PDUs at any time,
* which the broken target may still choke on.
*/
#define INVALID_ORDERING_ASSUMPTIONS 0
/* periodically stall reading data to test data arriving
* after aborts have started
*/
#define TEST_DELAYED_DATA 0
/* fake sense indicating ILLEGAL_REQUEST for all REPORT_LUNS commands */
#define FAKE_NO_REPORT_LUNS 0
/* fake check conditions on the first 2 attempts for each probe command */
#define FAKE_PROBE_CHECK_CONDITIONS 0
/* fake underflows on the first 4 attempts for each probe command */
#define FAKE_PROBE_UNDERFLOW 0
/* Timeout for commands during configuration */
#define CFG_TIMEOUT 30
#include "iscsi-common.h"
#include "iscsi-protocol.h"
#include "iscsi-ioctl.h"
#include "iscsi-io.h"
#include "iscsi-login.h"
#include "iscsi-trace.h"
#include "iscsi.h"
#include "iscsi-session.h"
#include "iscsi-version.h"
#include "iscsi-probe.h"
#include "iscsi-crc.h"
/*
* IMPORTANT NOTE: to prevent deadlock, when holding multiple locks,
* the following locking order must be followed at all times:
*
* hba_list_lock - access to collection of HBA instances
* session->portal_lock - access to a session's portal info
* session->task_lock - access to a session's collections of tasks
* hba->session_lock - access to an HBA's collection of sessions
* session->scsi_cmnd_lock - access to a session's list of Scsi_Cmnds
* (IRQSAVE)
* io_request_lock/host_lock - mid-layer acquires before calling queuecommand,
* eh_*, we must acquire before done() callback
* (IRQSAVE)
* iscsi_trace_lock - for the tracing code (IRQSAVE)
*
* Note: callers not in interrupt context must locally disable/restore
* interrupts when holding locks marked (IRQSAVE)
*/
#ifdef MODULE
MODULE_AUTHOR("Cisco Systems, Inc.");
MODULE_DESCRIPTION("iSCSI initiator");
# if defined(MODULE_LICENSE)
MODULE_LICENSE("GPL");
# endif
#endif
static int iscsi_system_is_rebooting;
static int this_is_iscsi_boot;
static sapiNBP_t iscsi_inbp_info;
static char inbp_interface_name[IFNAMSIZ];
/* Force tagged command queueing for all devices, regardless
* of whether they say they support it
*/
static int force_tcq = 0;
MODULE_PARM(force_tcq, "i");
MODULE_PARM_DESC(force_tcq,
"when non-zero, force tagged command queueing for all devices");
/* Queue depth for devices that don't support tagged command queueing.
* The driver used to use ISCSI_CMDS_PER_LUN, which was probably a bug.
* Default to 1 now, but let people who want to the old behavior set it higher.
*/
static int untagged_queue_depth = 1;
MODULE_PARM(untagged_queue_depth, "i");
MODULE_PARM_DESC(untagged_queue_depth,
"queue depth to use for devices that don't support tagged "
"command queueing");
static int translate_deferred_sense = 1;
MODULE_PARM(translate_deferred_sense, "i");
MODULE_PARM_DESC(translate_deferred_sense,
"translate deferred sense data to current sense data in "
"disk command responses");
static int iscsi_reap_tasks = 0;
MODULE_PARM(iscsi_reap_tasks, "i");
MODULE_PARM_DESC(iscsi_reap_task,
"when non-zero, the OS is allowed to reap pages from the "
"iSCSI task cache");
#ifndef UINT32_MAX
# define UINT32_MAX 0xFFFFFFFFU
#endif
/* We need it here for probing luns on lun change async event */
#define MAX_SCSI_DISKS 128
#define MAX_SCSI_DISK_PARTITIONS 15
#define MAX_SCSI_TAPES 32
#define MAX_SCSI_GENERICS 256
#define MAX_SCSI_CDROMS 256
#define WILD_CARD ~0
static int ctl_open(struct inode *inode, struct file *file);
static int ctl_close(struct inode *inode, struct file *file);
static int ctl_ioctl(struct inode *inode,
struct file *file, unsigned int cmd, unsigned long arg);
static int iscsi_inet_aton(char *asciiz,
unsigned char *ip_address, int *ip_length);
static int control_major;
static const char *control_name = "iscsictl";
static struct file_operations control_fops = {
owner:THIS_MODULE,
ioctl:ctl_ioctl, /* ioctl */
open:ctl_open, /* open */
release:ctl_close, /* release */
};
spinlock_t iscsi_hba_list_lock = SPIN_LOCK_UNLOCKED;
static iscsi_hba_t *iscsi_hba_list = NULL;
static volatile unsigned long init_module_complete = 0;
static volatile unsigned long iscsi_timer_running = 0;
static volatile pid_t iscsi_timer_pid = 0;
volatile unsigned int iscsi_log_settings =
LOG_SET(ISCSI_LOG_ERR) | LOG_SET(ISCSI_LOG_RETRY) | LOG_SET(ISCSI_LOG_TIMEOUT);
#define is_digit(c) (((c) >= '0') && ((c) <= '9'))
#define is_hex_lower(c) (((c) >= 'a') && ((c) <= 'f'))
#define is_hex_upper(c) (((c) >= 'A') && ((c) <= 'F'))
#define is_space(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\0')
#if DEBUG_TRACE
spinlock_t
iscsi_trace_lock = SPIN_LOCK_UNLOCKED;
static
iscsi_trace_entry_t
trace_table[ISCSI_TRACE_COUNT];
static int
trace_index = 0;
# define ISCSI_TRACE(P_TYPE, P_CMND, P_TASK, P_DATA1, P_DATA2) \
iscsi_fill_trace((P_TYPE), (P_CMND), (P_TASK), (P_DATA1), (P_DATA2))
#else
# define ISCSI_TRACE(P_TYPE, P_CMND, P_TASK, P_DATA1, P_DATA2)
#endif
#define MAX_PORTALS 32 /*
* 32 is the sizeof(unsigned int).
* If max portals to a target exceeds 32 then
* we need to change the preferred_portal_bitmap,
* preferred_subnet_bitmap from unsigned int to
* an array of unsigned int's.
*/
/* Returns 0 on success, non zero on error */
sta
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
linux-iscsi-3.6.3.gz (67个子文件)
linux-iscsi-3.6.3
common
auth
iscsiAuthClient.h 12KB
iscsiAuthClientGlue.c 5KB
iscsiAuthClient.c 69KB
iscsiAuthClientGlue.h 1KB
login
iscsi-login.c 43KB
iscsi-login.h 3KB
utils
iscsi-device.c 5KB
scsi-info.c 15KB
iscsilun.c 9KB
scsi-info.h 2KB
iscsi-ls.c 18KB
iscsigt.c 7KB
iscsi-boot
iscsi-network-boot.c 10KB
init.c 11KB
mkinitrd.iscsi 9KB
iscsi-iname.c 4KB
include
COPYING 18KB
daemon
iscsi-linux.c 33KB
iscsi-bindings.c 29KB
iscsi-io.c 14KB
iscsid.c 69KB
discovery
iscsi-discovery.c 43KB
iscsi-slp-discovery.h 812B
iscsi-discovery.h 588B
iscsi-slp-discovery.c 22KB
iscsi-config.c 89KB
include
iscsi-limits.h 1KB
iscsi-bindings.h 540B
iscsi-config.h 12KB
iscsid.h 5KB
iscsi-session.h 14KB
iscsi-hooks.h 2KB
Makefile 28KB
man
iscsid.8 5KB
iscsi-ls.1 3KB
iscsi.bindings.5 3KB
iscsi.conf.5 18KB
misc
md5.c 8KB
scripts
upgrade.sh 889B
iscsi-mountall 3KB
install.sh 11KB
iscsi-umountall 2KB
rc.iscsi 13KB
remove.sh 3KB
string-buffer.c 6KB
iscsi.conf 21KB
include
md5.h 1KB
string-buffer.h 2KB
README 79KB
driver
iscsi.c 505KB
iscsi-crc.c 5KB
iscsi-probe.c 34KB
include
iscsi-limits.h 1KB
iscsi-trace.h 3KB
iscsi-crc.h 220B
iscsi.h 5KB
iscsi-kernel.h 9KB
iscsi-probe.h 2KB
iscsi-session.h 14KB
iscsi-task.h 3KB
include
iscsi-common.h 2KB
iscsi-ioctl.h 6KB
iscsi-io.h 1KB
iscsi-portal.h 2KB
iscsi-protocol.h 15KB
iscsi-platform.h 4KB
iscsi-version.h 2KB
共 67 条
- 1
资源评论
- xuesr2014-04-28在rhel5.2上安装过了.还需要很多依赖包
- 叹息流年2015-10-19源码 谢谢楼主
- 素颜朝天2014-06-10源码 可以参考下
zealsoft_zhu
- 粉丝: 0
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功